perf(bench): add a focused route-lookup benchmark for D4
bench:compare reports end-to-end req/s with 50 and 200 filler routes. Lookup is a few percent of a request there, so it cannot judge D4's thresholds (at most 5% median regression at 10 routes, at least 20% improvement at 500), which are stated in median lookup time. bench:lookup measures exactly what dispatch does with a normalized path: resolveRoute, and on a miss allowedMethods. It covers 10, 100 and 500 total HTTP routes from a recorded generator, with static hit, late parameter hit, method miss and path miss workloads. Each answer is checked before timing, so an implementation that answers wrongly cannot post a number. Warm-up is time-boxed and calibrates the iterations per sample; every sample is kept. The router under test is a module path. LOOKUP_ROUTERS takes several, and each run measures them in separate child processes, alternating which goes first, so CARD-07/10 can run this same harness on base and head. Refs #109 Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
2 files changed
+274
No files matched your search
@@ -103,6 +103,7 @@
|
||||
"complexity:cyclomatic": "cyclomatic-complexity \"src/**/*.ts\" -tw 15 -te 25",
|
||||
"bench": "tsx bench/run.ts",
|
||||
"bench:compare": "tsx bench/compare.ts",
|
||||
"bench:lookup": "tsx bench/lookup.ts",
|
||||
"prepublishOnly": "npm run lint && npm run complexity:check && npm run typecheck && npm test && npm run build",
|
||||
"prepare": "git config core.hooksPath .githooks || true"
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user