mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
5f688d274a
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>
13 lines
364 B
JavaScript
13 lines
364 B
JavaScript
'use client'
|
|
import { useEffect } from 'react'
|
|
|
|
// Marks shell hydration for the client-trace harness. Effects flush after
|
|
// the initial hydration commit, so this measures the shell, not streamed
|
|
// Suspense content that hydrates later.
|
|
export default function HydrationMark() {
|
|
useEffect(() => {
|
|
performance.mark('bench:hydrated')
|
|
}, [])
|
|
return null
|
|
}
|