diff --git a/AGENTS.md b/AGENTS.md index 82bbc1e..03c5ac1 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -55,6 +55,14 @@ feature/* → develop → main → [promote.yml] → GitHub main **Only `hotfix/*` can still cause real drift**, since it branches from and returns to `main`. That case genuinely needs a back-merge; nothing else does. +**Delete the branch when the work lands.** Both sides, as the last step of merging rather than a chore left for later: + +```bash +git branch -d && git push origin --delete +``` + +On 2026-09-22 this repository carried 36 branches on Gitea and 29 locally, every one but a single stale docs branch already merged into `develop`, some of them since July. At that size the branch list stops describing the work in flight and becomes something a release has to audit commit by commit — which is both when it costs the most and when nobody has the patience for it. `git branch -r --merged origin/develop` is the check. A branch whose commits were rebased on the way in will not appear there even though its content did land, so confirm that case by content (`git diff develop -- `) rather than by the flag. Never `develop`, `main`, or a `release/*` that has not shipped yet. + **Diagnosing "this branch is ahead of main".** Usually it is pre-rebase duplication, not unmerged work: the same content under different SHAs, because contributions are rebased on their way into `develop`. Confirm before acting: ```bash diff --git a/BENCHMARKS.md b/BENCHMARKS.md index 644bc89..115e00c 100644 --- a/BENCHMARKS.md +++ b/BENCHMARKS.md @@ -4,12 +4,12 @@ ## Environment -- **Date**: 2026-09-02 -- **Commit**: 8c5855c +- **Date**: 2026-09-22 +- **Commit**: daf0fed - **Node**: v22.22.2 -- **OS**: darwin -- **CPU**: Apple M4 Max (16 cores) -- **RAM**: 69 GB +- **OS**: linux +- **CPU**: AMD Ryzen 7 3700X 8-Core Processor (16 cores) +- **RAM**: 67 GB - **Core-pinned**: no - **autocannon config**: 100 connections, 10s duration, 5 runs (1 warmup discarded), pipelining 1 @@ -29,74 +29,74 @@ | Framework | req/s (median) | p50 (ms) | p99 (ms) | p999 (ms) | CV | min–max req/s | | --- | --- | --- | --- | --- | --- | --- | -| raw-http | 119,357 | 0.00 | 1.00 | 1.00 | 0.4% | 118,560–120,067 | -| nestjs-fastify | 98,039 | 0.00 | 1.00 | 2.00 | 1.2% | 96,073–99,680 | -| fastify | 89,097 | 1.00 | 1.00 | 2.00 | 0.1% | 88,864–89,207 | -| green-tea | 87,473 | 1.00 | 2.00 | 2.00 | 0.3% | 86,903–87,607 | -| express | 24,677 | 3.00 | 5.00 | 8.00 | 0.2% | 24,647–24,769 | -| nestjs-express | 21,879 | 4.00 | 6.00 | 9.00 | 0.2% | 21,845–21,953 | +| raw-http | 41,631 | 2.00 | 3.00 | 4.00 | 0.6% | 41,343–41,974 | +| nestjs-fastify | 32,419 | 3.00 | 4.00 | 6.00 | 0.5% | 32,103–32,583 | +| fastify | 32,170 | 3.00 | 3.00 | 5.00 | 1.3% | 31,236–32,356 | +| green-tea | 29,777 | 3.00 | 6.00 | 7.00 | 0.4% | 29,557–29,873 | +| express | 10,546 | 8.00 | 13.00 | 18.00 | 0.4% | 10,480–10,625 | +| nestjs-express | 9,680 | 9.00 | 15.00 | 21.00 | 0.6% | 9,567–9,739 | ### Route param | Framework | req/s (median) | p50 (ms) | p99 (ms) | p999 (ms) | CV | min–max req/s | | --- | --- | --- | --- | --- | --- | --- | -| raw-http | 120,905 | 0.00 | 1.00 | 1.00 | 0.5% | 119,927–121,713 | -| nestjs-fastify | 91,849 | 1.00 | 1.00 | 2.00 | 0.3% | 91,825–92,599 | -| fastify | 88,317 | 1.00 | 1.00 | 2.00 | 0.2% | 87,997–88,439 | -| green-tea | 86,595 | 1.00 | 2.00 | 2.00 | 0.2% | 86,368–86,880 | -| express | 24,200 | 3.00 | 5.00 | 8.00 | 0.2% | 24,158–24,260 | -| nestjs-express | 21,182 | 4.00 | 6.00 | 9.00 | 0.7% | 21,150–21,518 | +| raw-http | 41,756 | 2.00 | 3.00 | 4.00 | 1.1% | 40,953–42,017 | +| fastify | 31,708 | 3.00 | 4.00 | 5.00 | 0.5% | 31,359–31,847 | +| nestjs-fastify | 29,880 | 3.00 | 4.00 | 6.00 | 0.3% | 29,745–29,961 | +| green-tea | 28,706 | 3.00 | 6.00 | 7.00 | 0.6% | 28,562–29,051 | +| express | 10,376 | 9.00 | 12.00 | 17.00 | 0.4% | 10,364–10,453 | +| nestjs-express | 9,257 | 10.00 | 15.00 | 21.00 | 0.2% | 9,244–9,285 | ### Pipeline (3 steps) (approximation) | Framework | req/s (median) | p50 (ms) | p99 (ms) | p999 (ms) | CV | min–max req/s | | --- | --- | --- | --- | --- | --- | --- | -| raw-http | 118,996 | 0.00 | 1.00 | 1.00 | 0.3% | 118,583–119,584 | -| nestjs-fastify | 89,527 | 1.00 | 2.00 | 2.00 | 1.0% | 87,572–90,028 | -| fastify | 86,671 | 1.00 | 1.00 | 2.00 | 0.1% | 86,490–86,793 | -| green-tea | 80,079 | 1.00 | 2.00 | 2.00 | 0.2% | 80,026–80,375 | -| express | 24,325 | 3.00 | 5.00 | 8.00 | 0.2% | 24,281–24,407 | -| nestjs-express | 20,872 | 4.00 | 6.00 | 9.00 | 0.2% | 20,801–20,940 | +| raw-http | 39,897 | 2.00 | 3.00 | 5.00 | 0.6% | 39,847–40,441 | +| fastify | 31,436 | 3.00 | 4.00 | 6.00 | 0.6% | 31,079–31,563 | +| nestjs-fastify | 29,403 | 3.00 | 4.00 | 6.00 | 0.6% | 29,151–29,689 | +| green-tea | 26,839 | 3.00 | 6.00 | 8.00 | 0.1% | 26,783–26,872 | +| express | 10,365 | 9.00 | 12.00 | 18.00 | 1.3% | 10,171–10,542 | +| nestjs-express | 9,256 | 10.00 | 15.00 | 22.00 | 0.5% | 9,187–9,302 | ### POST JSON + validation | Framework | req/s (median) | p50 (ms) | p99 (ms) | p999 (ms) | CV | min–max req/s | | --- | --- | --- | --- | --- | --- | --- | -| raw-http | 104,288 | 0.00 | 1.00 | 1.00 | 0.4% | 103,776–104,916 | -| green-tea | 70,298 | 1.00 | 2.00 | 3.00 | 1.0% | 68,972–70,607 | -| fastify | 65,905 | 1.00 | 2.00 | 3.00 | 0.3% | 65,725–66,367 | -| nestjs-fastify | 63,318 | 1.00 | 2.00 | 3.00 | 0.9% | 62,454–63,747 | -| express | 20,297 | 4.00 | 6.00 | 10.00 | 0.5% | 20,158–20,414 | -| nestjs-express | 18,788 | 5.00 | 7.00 | 10.00 | 0.3% | 18,684–18,862 | +| raw-http | 31,783 | 3.00 | 5.00 | 6.00 | 0.4% | 31,517–31,825 | +| green-tea | 22,005 | 4.00 | 7.00 | 9.00 | 0.7% | 21,736–22,187 | +| fastify | 20,430 | 4.00 | 8.00 | 9.00 | 0.4% | 20,398–20,601 | +| nestjs-fastify | 18,597 | 4.00 | 8.00 | 11.00 | 0.2% | 18,540–18,658 | +| express | 8,440 | 11.00 | 16.00 | 24.00 | 0.3% | 8,408–8,492 | +| nestjs-express | 7,666 | 12.00 | 18.00 | 26.00 | 0.3% | 7,645–7,703 | ## Step-scaling (green-tea) | Path | Steps | req/s | | --- | --- | --- | -| /steps/0 | 0 | 88,108 | -| /steps/3 | 3 | 79,951 | -| /steps/5 | 5 | 74,127 | +| /steps/0 | 0 | 29,196 | +| /steps/3 | 3 | 26,564 | +| /steps/5 | 5 | 25,314 | -Each additional pipeline step costs roughly 2,796 req/s (-15.9% over 5 steps), on this box. +Each additional pipeline step costs roughly 776 req/s (-13.3% over 5 steps), on this box. ## green-tea across runtimes | Scenario | node | deno | bun | | --- | --- | --- | --- | -| JSON hello (overhead) | 90,976 | 153,408 | 131,674 | -| Route param | 88,905 | 146,368 | 126,909 | -| Pipeline (3 steps) | 82,045 | 136,256 | 117,489 | -| POST JSON + validation | 72,236 | 106,662 | 95,124 | +| JSON hello (overhead) | 30,379 | 51,888 | 46,300 | +| Route param | 29,204 | 51,786 | 42,788 | +| Pipeline (3 steps) | 27,208 | 50,692 | 39,644 | +| POST JSON + validation | 22,609 | 35,743 | 31,960 | Same application, same built bundle, same box — only the runtime differs. Read across a row, never against the cross-framework tables above: those measure other frameworks on Node, and nobody ran fastify on Bun here. A runtime that is not installed is absent rather than zero. ## Cost of secure-by-default (green-tea) | Label | req/s | | --- | --- | -| security:false (parity) | 87,473 | -| security:true (default) | 83,773 | +| security:false (parity) | 29,777 | +| security:true (default) | 28,919 | -The real cost of running secure-by-default (rather than the parity-mode `security:false` used above) is ~4.2% req/s on this box. +The real cost of running secure-by-default (rather than the parity-mode `security:false` used above) is ~2.9% req/s on this box. > Scope: this micro-bench currently measures the security-**headers** cost only (`security:false` vs > `security:true` on `/hello`). The incremental cost of `@body` validation and CORS is not separately @@ -136,6 +136,56 @@ was benchmarked as it landed — the numbers are still in the code, cited below file between `26.7` and `26.9`, so nothing added them up. That is the gap this section and `npm run bench:compare` exist to close. +### The release gate: `26.9.0-beta.1` → `26.9.0-beta.2` + +Ten cases, both trees on one box in one sitting, alternating which side ran first each round, sharing +one `node_modules` — the two revisions differ by a version string and nothing else in `package.json`, +so the only thing that moved between the sides is green-tea. Medians of three rounds: + +| Scenario | 26.9.0-beta.1 | 26.9.0-beta.2 | Δ | | +| --- | --- | --- | --- | --- | +| hello | 90,615 | 89,853 | −0.8% | overlaps | +| param | 86,956 | 87,572 | +0.7% | overlaps | +| pipeline (3 steps) | 80,061 | 81,504 | +1.8% | overlaps | +| steps5 | 75,436 | 75,238 | −0.3% | overlaps | +| validate (POST) | 70,240 | 73,568 | +4.7% | overlaps | +| hello + security | 83,738 | 84,890 | +1.4% | overlaps | +| hello + cors predicate | 82,237 | 82,528 | +0.4% | overlaps | +| preflight + cors predicate | 111,223 | 114,220 | +2.7% | overlaps | +| param, 50 routes | 83,505 | 87,078 | +4.3% | **flagged** | +| param, 200 routes | 73,289 | 73,335 | +0.1% | overlaps | + +Nine rows overlap and therefore say nothing, which is the result this gate exists to produce. The +release is a breaking one — `Plugin` became `{ name, mount }`, `serveDeno()` and `serveBun()` became +async, `@Provider({ export: true })` stopped being a thing a teapot can do, and an `HttpError` is now +recognised by a brand rather than by `instanceof` — but all of that is boot-time or error-path work. +None of it sits on the per-request path these cases walk, and the table agrees. + +The tenth row is why "flagged" is not a synonym for "found something". `param, 50 routes` came out ++4.3% with separated ranges, in green-tea's favour, and it did not survive being asked twice: re-run +alone at seven rounds it is **+0.5% and overlapping**, with both sides swinging between 80,794 and +88,259 req/s. The reason to doubt it before re-running was that it had no mechanism — the matcher +work that could produce it would have to show at 200 routes too, and that row had already said ++0.1%. Treat a flagged row as an instruction to measure again, whichever direction it points; a win +nobody can explain is a measurement problem more often than it is a win. + +The cross-framework tables above moved to a quiet box for this release, which is why their absolute +numbers are roughly a third of the previous run's: an idle 2019 desktop Ryzen against a laptop M4 +Max. Two attempts on that laptop were discarded first, and the reason is worth recording. Each +framework's delta against its own previous number tracked its position in the run order rather than +anything in its code — the one measured second lost 7%, the ones measured last gained — while a +browser and the window server held around 60% of the machine throughout. That run would have read +as green-tea overtaking Fastify, which is the most flattering available reading of a broken +measurement and exactly the kind this file exists to refuse. The gate table above survives the same +contention, because both sides pay it and the order alternates; an absolute cross-framework number +does not. + +What survived the move is the shape, and that is the part worth trusting. On both machines green-tea +is behind Fastify on `hello`, `param` and `pipeline` and ahead of it on `validate`, and roughly +2.8× ahead of Express throughout. The *size* of the gap did not survive: against Fastify it is +2-8% on the M4 and 7-15% here. A percentage quoted without the hardware it was measured on is not a +fact about the framework. + ### The release gate: `26.8.0-beta.1` → `26.9.0-beta.1` Both trees measured on one box in one sitting, alternating which side ran first each round, sharing diff --git a/CHANGELOG.md b/CHANGELOG.md index 18ad0c6..a941b6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). green-tea uses calendar versioning: `YY.M.PATCH` — the month is not zero-padded, since npm treats versions as semver and semver forbids leading zeros. -## [Unreleased] +## [26.9.0-beta.2] - 2026-09-22 ### Breaking @@ -642,6 +642,7 @@ change before the stable release. - **Benchmarks** — reproducible `npm run bench` harness vs Express 5, Fastify 5, NestJS, and raw `http`; results in [BENCHMARKS.md](./BENCHMARKS.md). +[26.9.0-beta.2]: https://github.com/Expressive-Tea/green-tea/compare/v26.9.0-beta.1...v26.9.0-beta.2 [26.9.0-beta.1]: https://github.com/Expressive-Tea/green-tea/compare/v26.8.0-beta.1...v26.9.0-beta.1 [26.8.0-beta.1]: https://github.com/Expressive-Tea/green-tea/compare/v26.8.0-beta.0...v26.8.0-beta.1 [26.8.0-beta.0]: https://github.com/Expressive-Tea/green-tea/compare/v26.7.0-beta.0...v26.8.0-beta.0 diff --git a/README.md b/README.md index 68daa94..92f2514 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ npm install busboy # multipart/form-data file uploads - **The type is the contract.** What a handler reads from the context *is* its dependency list. In the typed `flow` core, a handler that reads `ctx.user` **fails to compile** if no step produces `user`. *Why it matters:* whole classes of "it was undefined in prod" disappear at compile time. - **You can see the request before it runs.** `app.explain('/users/:id')` prints the ordered chain with origins; `app.graph()` / `GET /__graph__` render it as a live diagram; `app.openapi()` projects the same metadata into an OpenAPI 3.1 spec. *Why it matters:* onboarding, debugging, audits, and API docs are reading, not archaeology. (NestJS puts the graph behind a paid Devtools plan.) - **One primitive for real-time.** Declare the transport — SSE, ndjson, or a WebSocket duplex — and return an `AsyncIterable`; backpressure and cleanup are handled. *Why it matters:* no separate gateway, adapter, or library to bolt on. -- **The same app runs on Node, Deno, Bun, and the edge.** One codebase, one import; you swap the entry point (`app.listen` → `serveDeno` / `serveBun` / `edgeHandler`) and nothing else. HTTP, SSE, and WebSocket — including rooms and channels — behave identically on all four. *Why it matters:* the graph model isn't a bet on one runtime's future, and no other opinionated/DI framework runs everywhere. +- **The same app runs on Node, Deno, Bun, and the edge.** One codebase, one import; you swap the entry point (`await app.listen()` → `await serveDeno()` / `await serveBun()` / `edgeHandler`) and nothing else — each one boots the app before it binds, so a provider that cannot start fails the deploy instead of answering `500`s from a port that looks healthy. HTTP, SSE, and WebSocket — including rooms and channels — behave identically on all four. *Why it matters:* the graph model isn't a bet on one runtime's future, and no other opinionated/DI framework runs everywhere. - **A remote dependency looks like a local one.** `@needs('billing')` resolves the same whether `billing` lives in this process or on another node (mesh, experimental). *Why it matters:* no gRPC layer or message-pattern DSL to learn — there's the graph, and some nodes happen to live elsewhere. - **Plugins can't sabotage you.** A plugin is `{ name, mount(api) }`. It gets `bus.on(...)` (observe), `scope.add(...)` (extend its own scope) and `onShutdown(...)` (release what it opened). There is no API to reorder or delete another scope's steps. *Why it matters:* installing a plugin can't break your body parser. @@ -153,7 +153,9 @@ without growing the runtime dependency tree past `reflect-metadata`: We built a reproducible [autocannon harness](./BENCHMARKS.md) comparing green-tea to Express 5, Fastify 5, NestJS (on both Express and Fastify), and raw Node `http` — and we wrote it to be **hard on ourselves**, not flattering. -On that harness, **green-tea handled more requests per second than every other framework in 3 of 4 scenarios** (JSON response, routing, and body-parsing-plus-validation), behind only raw `http` with no framework at all. In the fourth (a multi-step pipeline) it lands even with Fastify. +On that harness green-tea is in the same class as Fastify and NestJS-on-Fastify, roughly 2.8× ahead of Express, and behind raw `http` with no framework at all. Within that class the shape reproduces on two very different machines: green-tea is **behind** Fastify on the JSON, routing and pipeline scenarios, and **ahead** of it on POST-plus-validation. How far behind is a property of the box rather than a constant — 2-8% on a laptop M4 Max, 7-15% on an idle desktop Ryzen — which is why the table carries its hardware and its date, and why a percentage quoted without them says little. Read [BENCHMARKS.md](./BENCHMARKS.md) rather than a sentence here: a ranking written into prose once is a claim nobody re-measures. + +The question a release actually has to pass is the other one — *did the last N commits cost anything* — and comparing today's numbers against a table generated weeks ago answers it with two machines in a mood rather than two versions. `npm run bench:compare` runs both trees on one box in one sitting, alternating sides; `26.9.0-beta.1 → 26.9.0-beta.2` came out flat on every case. Read the honest caveats in [BENCHMARKS.md](./BENCHMARKS.md): the numbers are single-box + loopback (absolute throughput is overstated and differences compressed — trust the *ratios*), the cross-framework table runs green-tea with `security:false` for header parity, and the real cost of secure-by-default is measured separately. Regenerate any time with `npm run bench`. @@ -288,7 +290,7 @@ green-tea is **beta**, on the road to a release candidate. Express and Fastify h **What a teapot exports: steps and routes, and nothing else.** A `@Provider` marked `export: true` fails the boot with an error that says why — a provider's value *is* the object it builds, a pool or a client or a `db`, and the mesh moves data, not objects. Export a `@Step` instead: it runs on the teapot, per request, and its result is what comes back. That is also what lets a teacup boot without its teapot: a remote step holds nothing between requests, so a teacup whose teapot never answers still starts once the `bootTimeoutMs` grace runs out — it warns and carries on. Be precise about what that means, because it is narrower than it sounds. A teapot that never connected sent no manifest, so nothing of it reached the graph: its routes **404** rather than `503`, since nothing was registered to match, and a local step that `@needs` one of its tokens **still fails the boot**, naming the teapot that did not connect. That failure is deliberate — it is the check that catches a typo in a token name, which no amount of waiting will fix. `503` is what you get from a teapot that connected and *later* died, where the link and its exports do exist. So what the change buys is the teacup that does *not* depend on that teapot starting anyway, rather than refusing over a dependency it never had. Keeping a *needed* token serving while its teapot is legitimately away is a known gap, not an oversight: the intended answer is the `expects` list in [the mesh degrade plan](./docs/plans/2026-08-18-mesh-degrade-plan.md), which is planned and not built. -**What is settled, and what is still moving.** Present state, not a roadmap and not the API freeze — this is spare-time work by one person, and a schedule it cannot keep would cost more than it earns. The **graph is the settled part**: `needs`/`provides`, the order derived from them, and the boot-time failure when nothing provides a key have not changed since the beta hardening on 7 July, and `@Provider`, `@Step`, `@Route` and handler shapes still mean what they meant then — the decorator *set* has grown (`@Head`, `@Options`, `@Html`), which only ever adds. **Still moving:** the plugin API, which became `{ name, mount }` and gained `onShutdown`; `createApp`'s options, which gain fields most months; and the pipeline context, which in July became one object mutated in place rather than copied per step — so a step that captured it now sees later steps' writes. **Alpha:** mesh, above. Legacy decorators are a standing *external* risk rather than a green-tea one — see [Why legacy decorators](#why-legacy-decorators). The [matcha](https://github.com/Expressive-Tea/matcha) CLI ships from its own repository on its own version line, so nothing here speaks for it. +**What is settled, and what is still moving.** Present state, not a roadmap and not the API freeze — this is spare-time work by one person, and a schedule it cannot keep would cost more than it earns. The **graph is the settled part**: `needs`/`provides`, the order derived from them, and the boot-time failure when nothing provides a key have not changed since the beta hardening on 7 July, and `@Provider`, `@Step`, `@Route` and handler shapes still mean what they meant then — the decorator *set* has grown (`@Head`, `@Options`, `@Html`), which only ever adds. **Still moving:** the plugin API, which became `{ name, mount }` and gained `onShutdown`; the runtime entry points, where `serveDeno()` and `serveBun()` became async so they boot before they bind; `createApp`'s options, which gain fields most months; and the pipeline context, which in July became one object mutated in place rather than copied per step — so a step that captured it now sees later steps' writes. **Alpha:** mesh, above. Legacy decorators are a standing *external* risk rather than a green-tea one — see [Why legacy decorators](#why-legacy-decorators). The [matcha](https://github.com/Expressive-Tea/matcha) CLI ships from its own repository on its own version line, so nothing here speaks for it. ## Docs & development diff --git a/bench/results.json b/bench/results.json index 0182736..cba5976 100644 --- a/bench/results.json +++ b/bench/results.json @@ -1,11 +1,11 @@ { "env": { - "date": "2026-09-02", - "commit": "8c5855c", + "date": "2026-09-22", + "commit": "daf0fed", "node": "v22.22.2", - "os": "darwin", - "cpu": "Apple M4 Max (16 cores)", - "ram": "69 GB", + "os": "linux", + "cpu": "AMD Ryzen 7 3700X 8-Core Processor (16 cores)", + "ram": "67 GB", "pinned": false }, "config": { @@ -23,80 +23,80 @@ { "framework": "raw-http", "reqSec": { - "median": 119357.1, - "min": 118560, - "max": 120066.91, - "stddev": 484.9030139151553, - "cv": 0.0040636145553490976 + "median": 41630.55, + "min": 41342.55, + "max": 41973.82, + "stddev": 232.79156158245826, + "cv": 0.0055977118567263305 }, - "p50": 0, - "p99": 1, - "p999": 1 + "p50": 2, + "p99": 3, + "p999": 4 }, { "framework": "fastify", "reqSec": { - "median": 89096.73, - "min": 88864, - "max": 89207.28, - "stddev": 111.97759400880093, - "cv": 0.001257219726589825 + "median": 32170.19, + "min": 31235.64, + "max": 32355.64, + "stddev": 403.36620390905324, + "cv": 0.012593571579786219 }, - "p50": 1, - "p99": 1, - "p999": 2 + "p50": 3, + "p99": 3, + "p999": 5 }, { "framework": "express", "reqSec": { - "median": 24677.1, - "min": 24646.55, - "max": 24768.73, - "stddev": 43.02015834466458, - "cv": 0.0017417832565876405 + "median": 10545.82, + "min": 10480.37, + "max": 10625.1, + "stddev": 47.02831087759791, + "cv": 0.004456044641032285 }, - "p50": 3, - "p99": 5, - "p999": 8 + "p50": 8, + "p99": 13, + "p999": 18 }, { "framework": "green-tea", "reqSec": { - "median": 87473.46, - "min": 86903.28, - "max": 87607.28, - "stddev": 280.84365746087286, - "cv": 0.0032155347907296527 + "median": 29776.73, + "min": 29557.1, + "max": 29872.73, + "stddev": 120.92248317000461, + "cv": 0.004066812850878315 }, - "p50": 1, - "p99": 2, - "p999": 2 + "p50": 3, + "p99": 6, + "p999": 7 }, { "framework": "nestjs-express", "reqSec": { - "median": 21878.55, - "min": 21845.1, - "max": 21952.73, - "stddev": 41.00873789816055, - "cv": 0.0018731606009975037 + "median": 9679.64, + "min": 9566.91, + "max": 9738.55, + "stddev": 58.2951632985104, + "cv": 0.006025529205104781 }, - "p50": 4, - "p99": 6, - "p999": 9 + "p50": 9, + "p99": 15, + "p999": 21 }, { "framework": "nestjs-fastify", "reqSec": { - "median": 98039.28, - "min": 96072.73, - "max": 99680, - "stddev": 1215.4038343760499, - "cv": 0.012396669934655963 + "median": 32418.91, + "min": 32103.28, + "max": 32582.55, + "stddev": 159.574135748874, + "cv": 0.004929287112917938 }, - "p50": 0, - "p99": 1, - "p999": 2 + "p50": 3, + "p99": 4, + "p999": 6 } ] }, @@ -107,80 +107,80 @@ { "framework": "raw-http", "reqSec": { - "median": 120904.73, - "min": 119927.28, - "max": 121713.46, - "stddev": 658.0250991747977, - "cv": 0.005441723483024015 + "median": 41755.64, + "min": 40952.73, + "max": 42017.46, + "stddev": 439.72294183496837, + "cv": 0.010587809774433589 }, - "p50": 0, - "p99": 1, - "p999": 1 + "p50": 2, + "p99": 3, + "p999": 4 }, { "framework": "fastify", "reqSec": { - "median": 88317.1, - "min": 87997.1, - "max": 88439.28, - "stddev": 182.99174422907566, - "cv": 0.00207430857941761 + "median": 31708.37, + "min": 31359.28, + "max": 31846.55, + "stddev": 168.73300179869975, + "cv": 0.005328784944282288 }, - "p50": 1, - "p99": 1, - "p999": 2 + "p50": 3, + "p99": 4, + "p999": 5 }, { "framework": "express", "reqSec": { - "median": 24200, - "min": 24157.82, - "max": 24259.64, - "stddev": 39.43298619176589, - "cv": 0.0016290899720752198 + "median": 10375.64, + "min": 10364, + "max": 10452.73, + "stddev": 37.668132419858544, + "cv": 0.003621859193349617 }, - "p50": 3, - "p99": 5, - "p999": 8 + "p50": 9, + "p99": 12, + "p999": 17 }, { "framework": "green-tea", "reqSec": { - "median": 86594.91, - "min": 86368, - "max": 86880, - "stddev": 179.11650003279965, - "cv": 0.002068552609808656 + "median": 28706.19, + "min": 28562.19, + "max": 29050.91, + "stddev": 166.92265315408858, + "cv": 0.005803163694455583 }, - "p50": 1, - "p99": 2, - "p999": 2 + "p50": 3, + "p99": 6, + "p999": 7 }, { "framework": "nestjs-express", "reqSec": { - "median": 21181.82, - "min": 21149.82, - "max": 21517.82, - "stddev": 139.0670808494951, - "cv": 0.006540068168697097 + "median": 9257.1, + "min": 9244, + "max": 9285.46, + "stddev": 16.97885461390117, + "cv": 0.0018327336012062287 }, - "p50": 4, - "p99": 6, - "p999": 9 + "p50": 10, + "p99": 15, + "p999": 21 }, { "framework": "nestjs-fastify", "reqSec": { - "median": 91848.73, - "min": 91825.46, - "max": 92599.28, - "stddev": 296.55679952413783, - "cv": 0.00322222064035544 + "median": 29880, + "min": 29744.73, + "max": 29961.46, + "stddev": 90.38256681462417, + "cv": 0.003027383166346 }, - "p50": 1, - "p99": 1, - "p999": 2 + "p50": 3, + "p99": 4, + "p999": 6 } ] }, @@ -192,80 +192,80 @@ { "framework": "raw-http", "reqSec": { - "median": 118996.37, - "min": 118583.28, - "max": 119584, - "stddev": 341.82644850274596, - "cv": 0.002872466494470492 + "median": 39896.73, + "min": 39847.28, + "max": 40440.73, + "stddev": 235.6558649726337, + "cv": 0.0058846766178520865 }, - "p50": 0, - "p99": 1, - "p999": 1 + "p50": 2, + "p99": 3, + "p999": 5 }, { "framework": "fastify", "reqSec": { - "median": 86670.55, - "min": 86490.19, - "max": 86792.73, - "stddev": 97.03476704769095, - "cv": 0.0011197471063834074 + "median": 31436.37, + "min": 31078.55, + "max": 31562.91, + "stddev": 185.21052212010017, + "cv": 0.005909263441314207 }, - "p50": 1, - "p99": 1, - "p999": 2 + "p50": 3, + "p99": 4, + "p999": 6 }, { "framework": "express", "reqSec": { - "median": 24325.1, - "min": 24281.46, - "max": 24406.55, - "stddev": 50.44878456414985, - "cv": 0.002073096921615235 + "median": 10365.46, + "min": 10170.55, + "max": 10542.19, + "stddev": 129.83340146510884, + "cv": 0.01252603707960138 }, - "p50": 3, - "p99": 5, - "p999": 8 + "p50": 9, + "p99": 12, + "p999": 18 }, { "framework": "green-tea", "reqSec": { - "median": 80078.55, - "min": 80026.19, - "max": 80375.28, - "stddev": 126.5427427235537, - "cv": 0.00157915416330658 + "median": 26838.55, + "min": 26783.28, + "max": 26872, + "stddev": 35.930271582608675, + "cv": 0.0013390899572667937 }, - "p50": 1, - "p99": 2, - "p999": 2 + "p50": 3, + "p99": 6, + "p999": 8 }, { "framework": "nestjs-express", "reqSec": { - "median": 20872, - "min": 20800.73, - "max": 20940.37, - "stddev": 44.78034640330492, - "cv": 0.0021458031999967474 + "median": 9256.37, + "min": 9187.28, + "max": 9302.19, + "stddev": 42.180541200890175, + "cv": 0.0045584972844857205 }, - "p50": 4, - "p99": 6, - "p999": 9 + "p50": 10, + "p99": 15, + "p999": 22 }, { "framework": "nestjs-fastify", "reqSec": { - "median": 89527.28, - "min": 87572.37, - "max": 90027.64, - "stddev": 867.875358507201, - "cv": 0.009726340137622384 + "median": 29402.91, + "min": 29151.28, + "max": 29689.46, + "stddev": 189.99449229911926, + "cv": 0.006460862473261261 }, - "p50": 1, - "p99": 2, - "p999": 2 + "p50": 3, + "p99": 4, + "p999": 6 } ] }, @@ -276,80 +276,80 @@ { "framework": "raw-http", "reqSec": { - "median": 104288, - "min": 103776, - "max": 104916.37, - "stddev": 371.6125197245094, - "cv": 0.0035614220793380035 + "median": 31783.28, + "min": 31517.1, + "max": 31824.73, + "stddev": 111.5598838292694, + "cv": 0.003516116881358333 }, - "p50": 0, - "p99": 1, - "p999": 1 + "p50": 3, + "p99": 5, + "p999": 6 }, { "framework": "fastify", "reqSec": { - "median": 65905.46, - "min": 65725.1, - "max": 66366.55, - "stddev": 217.1439762369652, - "cv": 0.0032914527300013986 + "median": 20429.82, + "min": 20397.82, + "max": 20601.46, + "stddev": 73.12471046096515, + "cv": 0.0035727493036941836 }, - "p50": 1, - "p99": 2, - "p999": 3 + "p50": 4, + "p99": 8, + "p999": 9 }, { "framework": "express", "reqSec": { - "median": 20297.46, - "min": 20157.82, - "max": 20413.82, - "stddev": 99.50819415505447, - "cv": 0.004902635960088364 + "median": 8440.37, + "min": 8407.64, + "max": 8492, + "stddev": 29.52737333390846, + "cv": 0.003496408589959768 }, - "p50": 4, - "p99": 6, - "p999": 10 + "p50": 11, + "p99": 16, + "p999": 24 }, { "framework": "green-tea", "reqSec": { - "median": 70298.19, - "min": 68971.64, - "max": 70606.55, - "stddev": 704.8749988359651, - "cv": 0.01008804689681251 + "median": 22005.1, + "min": 21736, + "max": 22186.91, + "stddev": 149.1731413626461, + "cv": 0.006790967759795645 }, - "p50": 1, - "p99": 2, - "p999": 3 + "p50": 4, + "p99": 7, + "p999": 9 }, { "framework": "nestjs-express", "reqSec": { - "median": 18787.64, - "min": 18684.37, - "max": 18861.82, - "stddev": 57.13389375843402, - "cv": 0.0030419312672842124 + "median": 7666.37, + "min": 7645.28, + "max": 7703.46, + "stddev": 20.418688106732038, + "cv": 0.002662071942974812 }, - "p50": 5, - "p99": 7, - "p999": 10 + "p50": 12, + "p99": 18, + "p999": 26 }, { "framework": "nestjs-fastify", "reqSec": { - "median": 63317.82, - "min": 62453.82, - "max": 63746.91, - "stddev": 543.811870536126, - "cv": 0.00860786685722159 + "median": 18596.8, + "min": 18540.37, + "max": 18658.19, + "stddev": 37.943211988443956, + "cv": 0.0020404741150848267 }, - "p50": 1, - "p99": 2, - "p999": 3 + "p50": 4, + "p99": 8, + "p999": 11 } ] } @@ -358,89 +358,89 @@ { "path": "/steps/0", "steps": 0, - "reqSec": 88107.64 + "reqSec": 29196.37 }, { "path": "/steps/3", "steps": 3, - "reqSec": 79950.55 + "reqSec": 26563.64 }, { "path": "/steps/5", "steps": 5, - "reqSec": 74126.55 + "reqSec": 25314.19 } ], "secureCost": [ { "label": "security:false (parity)", - "reqSec": 87473.46 + "reqSec": 29776.73 }, { "label": "security:true (default)", - "reqSec": 83773.1 + "reqSec": 28918.55 } ], "runtimes": [ { "runtime": "node", "scenario": "JSON hello (overhead)", - "reqSec": 90976 + "reqSec": 30378.91 }, { "runtime": "node", "scenario": "Route param", - "reqSec": 88904.73 + "reqSec": 29203.64 }, { "runtime": "node", "scenario": "Pipeline (3 steps)", - "reqSec": 82045.1 + "reqSec": 27208 }, { "runtime": "node", "scenario": "POST JSON + validation", - "reqSec": 72235.64 + "reqSec": 22608.73 }, { "runtime": "deno", "scenario": "JSON hello (overhead)", - "reqSec": 153408 + "reqSec": 51888 }, { "runtime": "deno", "scenario": "Route param", - "reqSec": 146368 + "reqSec": 51785.6 }, { "runtime": "deno", "scenario": "Pipeline (3 steps)", - "reqSec": 136256 + "reqSec": 50692.37 }, { "runtime": "deno", "scenario": "POST JSON + validation", - "reqSec": 106661.82 + "reqSec": 35742.55 }, { "runtime": "bun", "scenario": "JSON hello (overhead)", - "reqSec": 131674.19 + "reqSec": 46299.64 }, { "runtime": "bun", "scenario": "Route param", - "reqSec": 126909.1 + "reqSec": 42788.37 }, { "runtime": "bun", "scenario": "Pipeline (3 steps)", - "reqSec": 117489.46 + "reqSec": 39643.64 }, { "runtime": "bun", "scenario": "POST JSON + validation", - "reqSec": 95124.37 + "reqSec": 31960 } ] } \ No newline at end of file diff --git a/bench/run.ts b/bench/run.ts index d913849..9255d8d 100644 --- a/bench/run.ts +++ b/bench/run.ts @@ -212,7 +212,10 @@ async function main(): Promise { const commit = execSync('git rev-parse --short HEAD').toString().trim(); const data: RenderData = { env: { - date: new Date().toISOString().slice(0, 10), + // Project time, not the runner's. A benchmark is often driven over ssh against a box that + // keeps UTC, and a run made on the evening of the 22nd then dates itself the 23rd — which + // reads as a day of drift against the commit and the changelog entry beside it. + date: new Date().toLocaleDateString('en-CA', { timeZone: 'America/Chicago' }), commit, node: process.version, os: os.platform(), diff --git a/bench/tsconfig.json b/bench/tsconfig.json index 09614f5..ce8d75c 100644 --- a/bench/tsconfig.json +++ b/bench/tsconfig.json @@ -1,5 +1,14 @@ { "extends": "../tsconfig.json", - "compilerOptions": { "experimentalDecorators": true, "emitDecoratorMetadata": true, "noEmit": true }, + "compilerOptions": { + "experimentalDecorators": true, + "emitDecoratorMetadata": true, + "noEmit": true, + // The bench servers are ES modules, run by tsx, Deno and Bun rather than by the CommonJS build + // the root config describes. `serveDeno`/`serveBun` became async in 26.9.0-beta.2, so two of + // them now open with a top-level `await`, which `module: commonjs` rejects outright. + "module": "es2022", + "moduleResolution": "bundler" + }, "include": ["."] }