Since the health probes (#145), every app.fetch request went through trackHealth's async wrapper around the memoized boot. That costs a new promise and extra microtask hops per request, even with the app already booted and with health off.
What changed
buildAppFetch (src/app/index.ts): once the route table is built, a request goes straight to it.
Before the table exists, a request still awaits the boot and then builds the table.
A failed boot never builds the table, so it still rejects every request.
Health probes are still answered before the boot, as before.
Node is not touched: listen() does not go through app.fetch.
How it was found
The goal was to find Deno's remaining drift against 26.9.0-beta.2. I ran app.fetch in a loop on Deno with no server (param route) at each of the 53 develop merges since beta.2. Three steps showed up:
Over HTTP:develop (068614e) → this branch on a Ryzen 3700X, docker node:22, 4 pinned cores. 15 cases including gzip, brotli and identity, 4 rounds. A/A noise band ±4%.
Runtime
Result
Deno
flat: −2.7% to +5.1%, every case overlapping
Bun
+2% to +5%, non-overlapping on 8 of 15 cases (hello +3.8%, POST +4%, preflight +4.7%, 50 routes +3.1%)
Over HTTP the gain is smaller than in the loop, because the server's per-request cost dilutes it.
Not run: Node, which does not use this path.
Tests
npm test: 1210 passed.
npm audit: clean.
Since the health probes (#145), every `app.fetch` request went through `trackHealth`'s `async` wrapper around the memoized boot. That costs a new promise and extra microtask hops per request, even with the app already booted and with `health` off.
## What changed
`buildAppFetch` (`src/app/index.ts`): once the route table is built, a request goes straight to it.
- **Before the table exists**, a request still awaits the boot and then builds the table.
- **A failed boot** never builds the table, so it still rejects every request.
- **Health probes** are still answered before the boot, as before.
Node is not touched: `listen()` does not go through `app.fetch`.
## How it was found
The goal was to find Deno's remaining drift against 26.9.0-beta.2. I ran `app.fetch` in a loop on Deno with no server (param route) at each of the 53 develop merges since beta.2. Three steps showed up:
| Merge | Effect in the loop | Status |
| --- | --- | --- |
| radix router (`cb123e3`) | about −5% net with few routes | within the D4 gate, gains at 200 routes |
| health probes (`1da6bf2`) | −6% | this PR |
| cookies (`50010da`) | −11% | recovered by #175 |
## Measured
- **In the loop (Mac):** +3% to +6% on the param route.
- **Over HTTP:** `develop (068614e) → this branch` on a Ryzen 3700X, docker `node:22`, 4 pinned cores. 15 cases including gzip, brotli and identity, 4 rounds. A/A noise band ±4%.
| Runtime | Result |
| --- | --- |
| Deno | flat: −2.7% to +5.1%, every case overlapping |
| Bun | +2% to +5%, non-overlapping on 8 of 15 cases (hello +3.8%, POST +4%, preflight +4.7%, 50 routes +3.1%) |
Over HTTP the gain is smaller than in the loop, because the server's per-request cost dilutes it.
Not run: Node, which does not use this path.
## Tests
- `npm test`: 1210 passed.
- `npm audit`: clean.
trackHealth wraps the memoized boot in an async function, so every
app.fetch request paid a new promise and microtask hops awaiting a boot
that had already settled. A built route table means the boot succeeded,
so the fetch handler now goes straight to it; only requests before the
table exists await the boot. A failed boot still rejects every request,
because the table is never built.
Measured in-process on Deno (app.fetch in a loop, param route): about
+3-6%.
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
chrnx
merged commit 1935e8e047 into develop2026-10-29 03:06:36 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Since the health probes (#145), every
app.fetchrequest went throughtrackHealth'sasyncwrapper around the memoized boot. That costs a new promise and extra microtask hops per request, even with the app already booted and withhealthoff.What changed
buildAppFetch(src/app/index.ts): once the route table is built, a request goes straight to it.Node is not touched:
listen()does not go throughapp.fetch.How it was found
The goal was to find Deno's remaining drift against 26.9.0-beta.2. I ran
app.fetchin a loop on Deno with no server (param route) at each of the 53 develop merges since beta.2. Three steps showed up:cb123e3)1da6bf2)50010da)Measured
develop (068614e) → this branchon a Ryzen 3700X, dockernode:22, 4 pinned cores. 15 cases including gzip, brotli and identity, 4 rounds. A/A noise band ±4%.Over HTTP the gain is smaller than in the loop, because the server's per-request cost dilutes it.
Not run: Node, which does not use this path.
Tests
npm test: 1210 passed.npm audit: clean.