0
Fork 0
mirror of https://github.com/TanStack/router.git synced 2026-11-16 19:38:07 +00:00
router/benchmarks
Manuel Schiller f8709334ac
chore(deps): bump @rsbuild/core to 2.3.1 (#8890)
Bump the workspace catalog and every e2e, example and benchmark
devDependency to ^2.3.1 so the lockfile resolves a single Rsbuild version.
Published peer ranges are unchanged.

The newer Rspack types allow falsy entries in a rule's `use` array, so the
Rsbuild RSC SWC integration now skips them instead of treating them as
loaders.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
History 2026-11-08 10:47:24 +01:00
..
bundle-size chore(deps): bump @rsbuild/core to 2.3.1 (#8890) 2026-11-08 10:47:24 +01:00
client-nav update generated route trees (#8841) 2026-11-01 23:36:36 +01:00
memory bump node version to 26.10.0 (#8509) 2026-10-17 17:04:18 +02:00
ssr update generated route trees (#8841) 2026-11-01 23:36:36 +01:00
AGENTS.md chore(deps): upgrade Vitest to 5 and migrate benchmarks to the bench fixture (#8723) 2026-10-16 00:41:32 +02:00
cpu-simulation.ts chore(deps): upgrade Vitest to 5 and migrate benchmarks to the bench fixture (#8723) 2026-10-16 00:41:32 +02:00
README.md bump node version to 26.10.0 (#8509) 2026-10-17 17:04:18 +02:00
tsconfig.json test: stabilize CPU simulation with isolated SSR workers and explicit V8 settings (#8248) 2026-09-05 20:54:53 +02:00

CPU simulation benchmarks

client-nav measures navigation, mounting, and React/Solid hydration in Node/jsdom; ssr measures server requests. Both suites run through the CodSpeed Vitest integration in CPU simulation mode.

Worker runtime

Every CPU benchmark project includes cpuSimulationExecArgv() from cpu-simulation.ts. It augments CodSpeed's worker flags only during CPU simulation, including the legacy instrumentation mode.

The pinned CodSpeed integration supplies --no-opt. In Node 24 this is an alias for --no-turbofan, so Maglev can still optimize and inline hot functions. The additional --no-maglev keeps the optimizing compiler out of the simulation. --always-sparkplug compiles baseline code on first use, so warmup does not leave functions approaching a later tier-up or batch-compilation threshold. The worker regression test checks that even a once-called function receives baseline code. The integration also omits the old --no-scavenge-task flag on Node 20 and newer, where V8 renamed it to --no-minor-gc-task. Supplying the renamed flag keeps minor GC tied to allocation pressure instead of scheduled foreground tasks. Both flags follow the fixes in CodSpeed's Node 24 support.

--initial-old-space-size=512 fixes the initial/minimum old-generation allocation budget at 512 MiB. Removing only this override after worker isolation left two Vue SSR scenarios with same-commit spreads above 2% in five full-suite repetitions. The paired default-heap comparison with stock incremental-marking tasks also exceeded 2%. Runtime comparisons and tested alternatives are recorded in PR #8248.

This is a GC-policy tradeoff. Minor collections and allocation work remain measured, and CodSpeed still explicitly collects before measurement. However, V8 can skip automatic full collections below this old-generation budget, so the benchmark can omit some eventual full-GC CPU cost from increased object retention. Repeatability does not establish representative production GC frequency. The flag does not preallocate 512 MiB; the existing 4096 MiB maximum remains. See V8's initial/minimum heap configuration.

The configuration preserves CodSpeed's incremental-marking task settings; the additional --no-incremental-marking-task from the initial stabilization proposal has been removed.

The flags are intentionally absent from ordinary Vitest timing and walltime runs.

Changing simulation compiler settings changes the measurement baseline. Compare repeatability within each configuration before interpreting performance changes between configurations as router improvements or regressions.

Worker isolation

Keep one SSR workload in each speed*.bench.ts file. These projects explicitly enable Vitest isolation; CodSpeed uses the forks pool, so every file receives a fresh worker. Multiple workloads in one file share the worker's runtime state, even though CodSpeed collects before each measurement. Later control cases remained noisy after the runtime flag corrections. Running the React plain dehydration and linked-CSS controls alone reduced their observed three-run spreads to 0.09% and 0.02% respectively.

Variant files keep their workload names, request counts, concurrency, payloads and assertions. CodSpeed includes the file path in a benchmark's identity, so moved variants start a new history. The first workload keeps speed.bench.ts; the additional variants have descriptive file names alongside it. Type-check includes cover all of these files.

Streaming workload

Deferred payloads in the SSR streaming scenario resolve after two task turns on Node. A real 1 ms timer lets elapsed host time decide which concurrent requests resolve together. Counted turns preserve the initial loading render and deferred payloads; the existing HTML assertions check both. These benchmarks execute in Node and use setImmediate directly.

Repeatability checks

Dispatch the existing Benchmarks workflow against an unchanged branch:

gh workflow run benchmarks.yml --ref <branch>

Wait for each workflow run to finish before dispatching the next repetition at the same commit. The workflow also runs memory benchmarks; exclude those results when assessing CPU repeatability. Check that every repetition has all expected CPU results (currently 134), rather than inherited results from an earlier run. Compare each benchmark's minimum and maximum across repetitions; keep input data, navigation/request counts, builds, dependencies and Node version fixed when testing runtime configuration changes.