chore(bench): scaffold benchmark harness — devDeps, scenarios, tsconfig
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
4 files changed
+2768
-1
No files matched your search
@@ -0,0 +1,25 @@
|
||||
export interface Scenario {
|
||||
name: string; // key
|
||||
title: string; // display
|
||||
method: 'GET' | 'POST';
|
||||
path: string; // route path (no host)
|
||||
body?: unknown; // JSON body for POST
|
||||
approximation?: boolean;
|
||||
}
|
||||
|
||||
// The always-valid validation body — every framework takes the success path.
|
||||
export const VALIDATE_BODY = { email: 'bench@example.com' };
|
||||
|
||||
export const SCENARIOS: Scenario[] = [
|
||||
{ name: 'hello', title: 'JSON hello (overhead)', method: 'GET', path: '/hello' },
|
||||
{ name: 'param', title: 'Route param', method: 'GET', path: '/users/42' },
|
||||
{ name: 'pipeline', title: 'Pipeline (3 steps)', method: 'GET', path: '/pipeline', approximation: true },
|
||||
{ name: 'validate', title: 'POST JSON + validation',method: 'POST', path: '/validate', body: VALIDATE_BODY },
|
||||
];
|
||||
|
||||
// green-tea-only step-scaling routes
|
||||
export const STEP_ROUTES = [
|
||||
{ name: 'steps0', steps: 0, path: '/steps/0' },
|
||||
{ name: 'steps3', steps: 3, path: '/steps/3' },
|
||||
{ name: 'steps5', steps: 5, path: '/steps/5' },
|
||||
];
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": { "experimentalDecorators": true, "emitDecoratorMetadata": true, "noEmit": true },
|
||||
"include": ["."]
|
||||
}
|
||||
Generated
+2730
File diff suppressed because it is too large.
Load diff
+8
-1
@@ -10,7 +10,8 @@
|
||||
"build": "tsc -p tsconfig.json",
|
||||
"test": "vitest run",
|
||||
"test:dev": "vitest",
|
||||
"typecheck": "tsc --noEmit -p tsconfig.json"
|
||||
"typecheck": "tsc --noEmit -p tsconfig.json",
|
||||
"bench": "tsx bench/run.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"reflect-metadata": "0.2.2"
|
||||
@@ -24,9 +25,15 @@
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/autocannon": "^7.12.7",
|
||||
"@types/express": "^5.0.6",
|
||||
"@types/node": "^18.19.0",
|
||||
"@types/ws": "^8.18.1",
|
||||
"autocannon": "^8.0.0",
|
||||
"express": "^5.2.1",
|
||||
"fastify": "^5.10.0",
|
||||
"graphql": "^16.9.0",
|
||||
"tsx": "^4.23.0",
|
||||
"typescript": "^5.5.0",
|
||||
"vitest": "^2.0.0",
|
||||
"ws": "^8.21.0"
|
||||
|
||||
Reference in new issue
Block a user