Skip to content

Commit 7632fc3

Browse files
committed
chore: update bench
1 parent d546f2d commit 7632fc3

File tree

1 file changed

+3
-35
lines changed

1 file changed

+3
-35
lines changed

test/bench/bench.impl.ts

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { compileRouter } from "rou3/compiler";
22
import * as _h3src from "../../src/index.ts";
3-
// import * as _h3v1 from "h3-v1";
43
import * as _h3nightly from "h3-nightly";
54
import { EmptyObject } from "../../src/utils/internal/obj.ts";
65

@@ -9,12 +8,11 @@ type AppFetch = (req: Request) => Response | Promise<Response>;
98
export function createInstances(): Array<[string, AppFetch]> {
109
return [
1110
["std", std()], // (also does warmup)
12-
// ["fastest", fastest()],
11+
["std-fast", stdFast()],
1312
["h3", h3(_h3src)],
1413
["h3-nightly", h3(_h3nightly as any)],
1514
["h3-compiled", h3(_h3src, true)],
16-
// ["h3-middleware", h3Middleware(_h3src)],
17-
// ["h3-v1", h3v1()],
15+
["h3-middleware", h3Middleware(_h3src)],
1816
] as const;
1917
}
2018

@@ -46,36 +44,6 @@ export function h3Middleware(lib: typeof _h3src): AppFetch {
4644
return app.fetch;
4745
}
4846

49-
export function h3v1(): AppFetch {
50-
const router = _h3v1.createRouter();
51-
const app = _h3v1.createApp();
52-
app.use(router);
53-
54-
// [GET] /
55-
router.get(
56-
"/",
57-
_h3v1.eventHandler(() => "Hi"),
58-
);
59-
60-
// [GET] /id/:id
61-
router.get(
62-
"/id/:id",
63-
_h3v1.eventHandler((event) => {
64-
const query = _h3v1.getQuery(event);
65-
_h3v1.setResponseHeader(event, "x-powered-by", "benchmark");
66-
return `${event.context.params!.id} ${query.name}`;
67-
}),
68-
);
69-
70-
// [POST] /json
71-
router.post(
72-
"/json",
73-
_h3v1.eventHandler((event) => _h3v1.readBody(event)),
74-
);
75-
76-
return _h3v1.toWebHandler(app);
77-
}
78-
7947
export function std() {
8048
return function (req: Request): Response | Promise<Response> {
8149
const url = new URL(req.url);
@@ -106,7 +74,7 @@ export function std() {
10674
};
10775
}
10876

109-
export function fastest(): AppFetch {
77+
export function stdFast(): AppFetch {
11078
return (request: Request) => {
11179
const [pathname, query] = parseUrl(request.url);
11280
switch (request.method) {

0 commit comments

Comments
 (0)