Commit Graph

3 Commits

Author SHA1 Message Date
dan 5f688d274a [Bench] Add client-trace attribution pass and document metrics to render-pipeline (#95828)
Added a bunch of stuff to the bench.

---

**New metrics in the HTTP benchmark**
- Report TTFB per route (time to first body byte), next to total
latency.
- Report each route's document size, how many bytes are inline Flight
payload, and the Flight share.

**New script: `pnpm bench:render-pipeline:client`**
- Loads each route in Chrome with tracing and 4x CPU throttling, and
breaks down where client time goes: evaluating chunks, evaluating inline
Flight scripts, compiling, background parsing, GC, time to hydration,
and blocking time before hydration.
- Also prints FCP/LCP/DOMContentLoaded/load from the same trace, and JS
transferred vs parsed.
- Off by default, separate from the timing benchmark, since tracing
perturbs timing.
- Hydration time comes from a small client component added to the
fixture root layout that calls `performance.mark`.

**Bug fixes**
- The benchmark was replacing the fixture's `next.config.js` with an
empty one during runs.
- If the port was already taken, the benchmark could silently measure
whatever server was already running there. Both scripts now refuse to
start if something is already on the port.
- A server that died on startup used to look like a slow server; now it
errors immediately.
- One failed request used to abort the whole run and throw away all
results. Now it costs one sample and gets counted in `errors`.
- Killing an already-dead server used to hang the script.
- Bad flags now error upfront instead of crashing at the end.

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-23 09:26:03 +02:00
Tim Neutkens ec28a4fdc6 Remove experimental.useNodeStreams flag as it's enabled (#93938)
### What?

Remove `experimental.useNodeStreams` from the public config surface and
make Node streams always-on for Node.js App Router rendering.

The smaller default-on change and dedicated CI cleanup landed in #94311.
The standalone compatibility update landed separately in #94347.

### Why?

Node streams are now the default Node.js runtime rendering path, so the
opt-in config and runtime selection plumbing are stale. Edge bundles
continue to use the web-stream path because Node streams are unavailable
there.

### How?

- Define `__NEXT_USE_NODE_STREAMS` as true for Node.js app runtime
bundles and false for edge user bundles.
- Remove config, schema, runtime, export, and server plumbing for
`experimental.useNodeStreams`.
- Delete the obsolete env-precedence fixture.
- Clean benchmark docs and scripts that still set or compare
`experimental.useNodeStreams`.

### Verification

- `pnpm --filter=next types`
- `pnpm build-all`

<!-- NEXT_JS_LLM_PR -->
2026-06-08 16:12:39 +02:00
Jimmy Lai 663c9151cf bench: render-pipeline benchmarks and stress routes (2/8) (#89863)
## Summary

Benchmark infrastructure for measuring render pipeline performance.

- **render-pipeline benchmark** (`bench/render-pipeline/`):
`benchmark.ts` for profiling render paths, `analyze-profiles.ts` for CPU
profile analysis
- **Stress routes** (`bench/basic-app/app/streaming/`): light, medium,
heavy, bulk, wide, chunkstorm variants for different streaming load
profiles
- **Basic app harness**: `benchmark.sh` runner script, `next.config.js`
- **Minimal server**: `bench/next-minimal-server/bin/minimal-server.js`
- **Docs**: `bench/BENCHMARKING.md` guide
- **Config**: eslint exclusion for bench paths, package.json bench
scripts

## Test plan

- [ ] No runtime behavior changes
- [ ] Benchmark scripts are standalone tooling

---------

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2026-02-17 09:40:26 +01:00