mirror of
https://github.com/honojs/hono.git
synced 2024-11-21 18:18:57 +01:00
chore: update benchmark (#3102)
This commit is contained in:
parent
cff2768de0
commit
bee3ade123
@ -11,13 +11,14 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@medley/router": "^0.2.1",
|
||||
"express": "^4.18.2",
|
||||
"find-my-way": "^7.4.0",
|
||||
"koa-router": "^12.0.0",
|
||||
"express": "^4.19.2",
|
||||
"find-my-way": "^8.2.0",
|
||||
"koa-router": "^12.0.1",
|
||||
"koa-tree-router": "^0.12.1",
|
||||
"memoirist": "^0.1.4",
|
||||
"memoirist": "^0.2.0",
|
||||
"mitata": "^0.1.6",
|
||||
"radix3": "^1.0.1",
|
||||
"radix3": "^1.1.2",
|
||||
"rou3": "^0.1.0",
|
||||
"trek-router": "^1.2.0"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
import { run, bench, group } from 'mitata'
|
||||
import { expressRouter } from './express.mts'
|
||||
import { findMyWayRouter } from './find-my-way.mts'
|
||||
import { regExpRouter, trieRouter } from './hono.mts'
|
||||
import { regExpRouter, trieRouter, patternRouter } from './hono.mts'
|
||||
import { koaRouter } from './koa-router.mts'
|
||||
import { koaTreeRouter } from './koa-tree-router.mts'
|
||||
import { medleyRouter } from './medley-router.mts'
|
||||
@ -9,10 +9,12 @@ import { memoiristRouter } from './memoirist.mts'
|
||||
import { radix3Router } from './radix3.mts'
|
||||
import type { Route, RouterInterface } from './tool.mts'
|
||||
import { trekRouter } from './trek-router.mts'
|
||||
import { rou3Router } from './rou3.mts'
|
||||
|
||||
const routers: RouterInterface[] = [
|
||||
regExpRouter,
|
||||
trieRouter,
|
||||
patternRouter,
|
||||
medleyRouter,
|
||||
findMyWayRouter,
|
||||
koaTreeRouter,
|
||||
@ -21,6 +23,7 @@ const routers: RouterInterface[] = [
|
||||
koaRouter,
|
||||
radix3Router,
|
||||
memoiristRouter,
|
||||
rou3Router,
|
||||
]
|
||||
|
||||
medleyRouter.match({ method: 'GET', path: '/user' })
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { RegExpRouter } from '../../../src/router/reg-exp-router/index.ts'
|
||||
import { TrieRouter } from '../../../src/router/trie-router/index.ts'
|
||||
import { PatternRouter } from '../../../src/router/pattern-router/index.ts'
|
||||
import type { Router } from '../../../src/router.ts'
|
||||
import type { RouterInterface } from './tool.mts'
|
||||
import { routes, handler } from './tool.mts'
|
||||
@ -18,3 +19,4 @@ const createHonoRouter = (name: string, router: Router<unknown>): RouterInterfac
|
||||
|
||||
export const regExpRouter = createHonoRouter('RegExpRouter', new RegExpRouter())
|
||||
export const trieRouter = createHonoRouter('TrieRouter', new TrieRouter())
|
||||
export const patternRouter = createHonoRouter('PatternRouter', new PatternRouter())
|
||||
|
19
benchmarks/routers/src/rou3.mts
Normal file
19
benchmarks/routers/src/rou3.mts
Normal file
@ -0,0 +1,19 @@
|
||||
import { addRoute, createRouter, findRoute } from 'rou3'
|
||||
import type { RouterInterface } from './tool.mts'
|
||||
import { handler, routes } from './tool.mts'
|
||||
|
||||
const name = 'rou3'
|
||||
const router = createRouter()
|
||||
|
||||
for (const route of routes) {
|
||||
addRoute(router, route.path, route.method, handler)
|
||||
}
|
||||
|
||||
export const rou3Router: RouterInterface = {
|
||||
name,
|
||||
match: (route) => {
|
||||
findRoute(router, route.path, route.method, {
|
||||
ignoreParams: false, // Don't ignore params
|
||||
})
|
||||
},
|
||||
}
|
@ -3,5 +3,8 @@
|
||||
"allowImportingTsExtensions": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "NodeNext"
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
"./src"
|
||||
]
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user