Repository navigation
Conversation
The static file handler benches read real files, so CodSpeed's single measured call hopped through the libuv thread pool and event loop and picked up unrelated callbacks, flipping results by 12% or more on PRs that never touched the plugin. Back the plugin with an in-memory fs and stop importing the shared payloads, so every measured call is the same microtask chain.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
orpc | 08e13f5 | Commit Preview URL Branch Preview URL |
Oct 06 2026, 04:09 AM |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Serves bench files from memory instead of disk —
benches/static-file-handler.bench.tsnow injects an in-memory fs viavi.mock('node:fs')/vi.mock('node:fs/promises')(createReadStream,stat,realpath) so the single call CodSpeed measures no longer waits on the libuv thread pool or absorbs unrelated callbacks, which was the source of the false regressions across unrelated PRs. - Drops the
./__shared__/payloadsimport — the file only used it fordrainBody; a local copy is inlined so building those payloads no longer shifts V8 compilation into the first measured call. - Deterministic representation metadata — fixed
mtimeand fixed 10KB buffers give a stable ETag, so all five scenarios still exercise the full plugin path (path resolution, containment, content type, ETag, conditional, range, streaming) and return 200, 200, 206bytes 0-1023/10240, 304, and fall through.
I verified the bench runs to completion, and the file passes eslint and the root tsc. The mock replaces only the fs surface the plugin actually reads, and the hoisted function declarations are safe to reference from the lazy vi.mock factories.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
More templates
@orpc/ai-sdk
@orpc/arktype
@orpc/bun
@orpc/client
@orpc/cloudflare
@orpc/contract
@orpc/experimental-effect
@orpc/evlog
@orpc/hibernation
@orpc/json-schema
@orpc/experimental-lock
@orpc/experimental-msw
@orpc/nest
@orpc/next
@orpc/node
@orpc/openapi
@orpc/opentelemetry
@orpc/pinia-colada
@orpc/pino
@orpc/publisher
@orpc/ratelimit
@orpc/server
@orpc/shared
@orpc/swr
@orpc/tanstack-query
@orpc/trpc
@orpc/valibot
@orpc/zod
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Merging this PR will improve performance by 52.74%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ⚡ | not modified (304) |
361.2 µs | 212.4 µs | +70.05% |
| ⚡ | range request |
1,016.6 µs | 667.8 µs | +52.24% |
| ⚡ | serve deeply nested encoded path |
1,020.7 µs | 672.8 µs | +51.72% |
| ⚡ | not found fall through |
329.9 µs | 238.1 µs | +38.58% |
Tip
Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.
Comparing claude/static-file-bench-determinism (08e13f5) with main (86c31c3)

The static file handler benchmarks read real files, so CodSpeed's single measured call depended on thread pool scheduling and on whatever else the event loop picked up, rather than on plugin code. They now serve the same files from an in-memory fs that still runs the whole plugin path: path resolution, containment checks, content type, ETag, conditional and range handling, and body streaming. Every measured call is now the same microtask chain, so these benches should stop flagging false regressions on unrelated PRs. The new numbers reset the baseline for all five benches.
Evidence
__shared__/payloads.ts, yet CodSpeed reports range request +60%, nested path +51% and serve file +48%. This bench imported that module just fordrainBody.[CodSpeed] … donelog. Locally that lands in a warm-up call, but which call it lands in depends only on timing.Results
Measured locally with the CodSpeed analysis runner (
CODSPEED_ENV=1 CODSPEED_RUNNER_MODE=simulation) under strace. Valgrind isn't available here, so this is not a CodSpeed run.payloads.tschange applied, give identical syscall counts for all 40 calls. Before this change they differed between runs.bytes 0-1023/10240, 304, and fall through.