* perf(router,start): update Seroval to 1.6.6
* perf(router,start): update Seroval to 1.6.7
* chore: update seroval to 1.6.7
seroval and seroval-plugins were pinned to ^1.6.2 while 1.6.7 is the
current release. The type surface is additive: two new options
(maxBase64Length, compactArrayBufferViews) and an isStream export.
Bundle (gzip): router-only scenarios unchanged; Start client bundles
grow 532-642 bytes from the upstream typed array and base64 handling.
react-start.minimal 98504 -> 99039 (+535).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* perf(benchmarks): compress bundle-size outputs once
* add link to readme in skill
* ci: apply automated fixes
* fix(benchmarks): persist timing flag in measurement command
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* chore(benchmarks): remove TSR_LINK_PERF opt-in flag
The router-core Link/path benchmarks and the react-link-performance
project are never part of the CodSpeed matrix or the client-nav/SSR
aggregate projects, so the env-var gate only added friction. Rely on
standard vitest name filtering (-t) to narrow runs instead.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* fix(router-core): treat 0 and false as provided _splat values
Splat interpolation used a falsy check, so _splat: 0 was omitted like a
missing param while $id: 0 interpolated to '/0'. Only undefined, null,
and '' now omit a splat segment, matching how other path params are
stringified.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* test(router-core): use path-derived ids in original-param-names fixtures
The matcher only uses route ids as routesById keys and for the pathless
'_' check, so unrelated ids worked but never occur in a real router.
Align the fixtures with the sibling test file's convention where each
id mirrors its fullPath.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* perf(solid-router): shorten conditional Link class and style spreads
Spread `cond && { value }` instead of `cond ? { value } : undefined`,
matching the neighbouring `active && STATIC_ACTIVE_ATTRIBUTES` spread.
Falsy operands spread to nothing, so the emitted props are unchanged.
Measured with the bundle-size benchmark on solid-router.full:
gzip 39205 -> 39198 (-7), raw -12, brotli -33.
Covered by the existing `six-adults-open` changeset.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* test(router-core): drop the unused server axis from interpolatePath tests
The `interpolatePath (server: $server)` block never read its `server`
argument since interpolation stopped taking a server flag, so it ran every
case twice under a misleading label. The remaining diff is re-indentation;
review with `git show -w`.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* test(router-core): interpolate paths through the production API in tests
`interpolateTestPath` only survived as a compatibility layer from the
segment-reuse refactor: it emulated the removed
`(path, params, decoder, usedParams, keys, metadata)` signature by parsing
the template, re-implementing the param-name loop and folding
`hasMissingPathParams` into a metadata flag.
Call the real functions instead. Tests now parse templates with
`parseSegments(false, { fullPath }, 0)` exactly like `buildLocation` does
for templates without a processed route, pass the segments to
`interpolatePath`, and read names and availability from `getParamNames`
and `hasMissingPathParams`. The prepared-route tests compare route-owned
segments against that standalone parse directly, and the interpolation
bench derives its reference values the same way.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* perf(router-core): reuse parsed route segments for interpolation
Capture original template segments during the existing route-tree parse.
Interpolation only substitutes current values and produces fresh metadata;
it never reparses known routes, including first use and trailing-slash
variants. Rebuild the captured data with the tree for HMR. Parse unknown
templates once per bounded entry and reuse their segments across decoder
changes. Update Devtools and internal test consumers.
Remove internal undefined-path/server-flag compatibility and the divergent
SSR scanner. Both runtimes follow the canonical splat grammar. Keep the
128-result route cache after measuring its removal rather than adding an
unproven configuration option.
Measured against 41e42009be with frozen production bundles:
- 26 client/SSR Link cases, 4 paired replicas each: client unique params
-3.94% CPU [95% CI -6.30,-1.52], optionals -2.58% [-4.34,-0.78].
Other cases inconclusive; no supported end-to-end slowdown.
- 1000-route client high-cardinality interpolation -18.55..-24.83%;
matching with fresh metadata -14.69..-19.12% (5 process samples).
- 1000-route client setup costs an extra 0.084..0.192 ms; sparse first use
costs about 0.23..0.28 us/call. Retained segment data adds about 200..298 B
per dynamic route in the measured fixtures.
- All 18 bundle cases add 303..392 gzip B; React minimal/full +311/+326 B.
- Cache-off saves 0.8..0.9 MiB per 1000 used routes and 1.2..1.5 MiB after
growth, but client encoding/splat Links regress 25.31%/12.71% and SSR
encoding/splats regress 21.76%/25.37%; retain result caching.
- Shared-value sampled allocations rise 2.18% client/5.23% SSR without that
cache. Native Vue peaks remain effectively unchanged (macOS captures,
not a new Linux CodSpeed CI run). Benchmark counts/JIT/GC flags unchanged.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* perf(router-core): avoid temporary route initialization joins
Build route IDs and full paths with direct string assembly and the existing
cleanPath normalizer. Avoid temporary filter/join arrays and the second ID
normalization. Pathless layouts keep the parent's fullPath unchanged.
Add a focused construction benchmark with fresh route objects and separate
processing-only / allocation-plus-processing cases at 100/1000/10000 routes.
Document why client-nav route-tree-scale is not a construction benchmark.
Standalone attribution against 41e42009be, otherwise unchanged Uint16Array
parser, 7 fresh process replicas and 1000 routes per tree:
- Client processRouteTree+route.init CPU improves 11.48-19.57% across
static, dynamic, nested and mixed trees (all 95% intervals below zero).
- Server CPU improves 9.39-22.29% (all 95% intervals below zero).
- React Router minimal gzip +6 bytes; the composed parse-once implementation
is measured separately against the required original bundle budget.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* perf(router-core): reuse stable path parameter decoders
Compare allowed-character values rather than recompiling the decoder on
every provider-style options update. Equivalent arrays retain warm route
paths; in-place edits and option removal update encoding correctly.
Publish the configuration key only after successful compilation, and
declare optional state without forcing an unused instance field.
Isolated against 3e0b23f46c with the same path-decoder.bench.ts, seven
alternating independent process pairs (200 locations per batch):
- Stable provider updates: 143.3707 -> 122.5572 us, -14.52%
(95% process interval -15.51% to -13.52%).
- No-update control: 119.1170 -> 118.8155 us, -0.25%
(interval -1.05% to +0.55%).
- Deliberately changing configuration every batch: 143.8213 -> 147.7340 us,
+2.72% (interval +1.38% to +4.08%). Reconfiguration remains the cold path.
These are decoder/update mechanism measurements, not a claim about every
React Link render. Standalone React minimal gzip: 86121 -> 86142 bytes
(+21); raw +48 bytes, Brotli +10 bytes.
Add coverage for equivalent options, mutation, removal, direct overrides
and retrying failed compilation.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* perf(router-core): simplify route-owned path interpolation
Share one canonical scanner between tree processing and unknown templates.
Retain compact dynamic records and derive original parameter names lazily,
instead of reconstructing them during matching. Keep initialization/indexing
and traversal in processRouteTree, including existing nested-mask behavior.
Make pathParamsAllowedCharacters initialization-only, as requested. Compile
the readonly decoder once, remove decoder keys/stamps/update invalidation,
and keep path results on each route. Preserve the shared bounded unmatched
template cache across SSR requests; lightweight matching stays router-local.
Do not add an encoding-specific cache, router-level route map or bulk clear.
Move Devtools-only navigation availability outside the hot formatter.
Preserve legacy standalone fallback match identity and cache behavior,
including inherited params and route-tree replacement. Retain useful encoding
comments and explicit tuple-slot labels.
Final measurements (Node 24.8.0, built production JS, unchanged workloads):
- Original React client-nav Link loop versus 41e42009be, four balanced
fresh-process pairs: CPU 2.5015016 -> 2.4370936 ms per 8-navigation batch,
-2.57% (95% process interval -3.72% to -1.42%). Wall -2.58%.
- Fresh 1000-route client processing/init: static -12.39%, dynamic -5.34%,
nested -6.54%, mixed -2.59%. Server static -9.12%; remaining intervals
are reported separately and the mixed-server result is inconclusive.
- All 18 gzip fixtures are below 41e by 47-88 bytes. React minimal:
85801 -> 85731; full: 89392 -> 89318. Raw JS -533..-697 bytes;
Brotli varies by fixture rather than uniformly shrinking.
- Full 26-case paired client/SSR Link suite: no supported regressions;
most small changes are inconclusive, not claimed as universal speedups.
- Warm retained path-cache heap saves about 7.8 KiB per 1000 routes in
default/custom configurations. Native Vue peaks remain near baseline;
peak, allocation totals and end outstanding are measured separately.
Existing literal grammar/URL/matching expectations are preserved. The
independent oracle covers 49638 segment cases and 338 matching/mask traces
within the old offset range. Initialization-only encoding deliberately
supersedes the previous live-update contract.
Detailed measurements and rejected experiments remain in uncommitted
session reports and LOG.md.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* perf(router-core): initialize routes directly during tree processing
Remove the optional initRoute callback and unconditionally call
route.init({ originalIndex: index }) at the start of the parent-first visit,
before indexing or parsing the route. Require init on this function's input
without imposing it on masks or the shared template-scanning RouteLike type.
Remove the Router and construction-benchmark forwarding wrappers. Adapt
preinitialized matcher fixtures through one test-only helper with a
non-enumerable no-op init; do not normalize their paths/IDs or change their
expected grammar/matching results. Add real-route initialization order,
index and exactly-once coverage.
Performance versus bc71b06207, seven independent process pairs per
shape/mode using the same built-JS entry and fresh route objects:
- Server static 1000-route processing/init: 0.7781686 -> 0.7623686 ms/tree,
CPU -2.06% (95% interval -3.26% to -0.84%); wall -2.10%.
- Other construction cells are inconclusive, with no supported slowdown.
- All 18 gzip fixtures improve by 10-26 bytes. React minimal:
85731 -> 85712 bytes (-19). Raw -20 bytes (-59 for Rsbuild);
Brotli remains fixture-dependent.
Object creation and forced GC are outside processing timers. The common
measurement entry's obsolete third argument is ignored by the new code,
so once-per-tree callback allocation savings are not overstated.
Full measurements and logs remain in the session's
direct-route-init-20260909 artifacts and uncommitted LOG.md.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* perf(router-core): pass route initialization indexes directly
Change the internal initializer to route.init(originalIndex). Update the
Route interface, BaseRoute implementation, processRouteTree contract and
both production call sites, including the standalone legacy fallback.
Remove object-literal arguments without adding compatibility wrappers.
Keep route ordering and stored indexes unchanged. Cover primitive arguments,
index zero and the large legacy fallback index explicitly.
Performance versus f2c2d55f99:
- Seven independent fresh-process construction comparisons per shape/mode
(100, 1000 and 10000 routes; static/dynamic/nested/mixed) show no
statistically supported timing difference. Do not claim an unproven
CPU or heap-byte improvement from the removed object literals.
- All 18 gzip fixtures improve by 7-13 bytes. React minimal:
85712 -> 85702 (-10); full: 89303 -> 89291 (-12).
- Raw JS decreases by 46 bytes in every fixture. Brotli varies.
The same production-JS phase entry and workloads are used on both sides.
Object creation and forced GC are outside processing timers. Detailed
samples, intervals and logs remain in numeric-route-init-20260909 session
artifacts and uncommitted LOG.md.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* update route trees
* ci: apply automated fixes
---------
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Keep comparison snapshots in SWC's existing node_modules exclusion so emitted JavaScript is not retranspiled and source-map positions remain valid. Preserve asynchronous ESM loading and add a failing-before source-integrity regression.
Four-replica identical-bundle calibration: client shared-params CPU +0.92% [-4.14%, +6.24%], wall +1.03% [-4.55%, +6.93%]; SSR CPU +0.17% [-6.32%, +7.11%], wall +0.15% [-6.44%, +7.21%]. Intervals include zero; no speedup is claimed. Production code is unchanged; baseline React Router gzip is 85797/89379 bytes.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* test(router): add opt-in React Link performance cases
Add 13 shared typed workloads measured through production client navigation and real SSR rendering: shared/unique params, updater functions, inheritance, relative targets, middleware chains, numeric parse/stringify, optional/splat segments, encoding, masks, rewrites, and active props with structured search and style merging.
Keep all 26 benchmarks outside the existing client-nav/SSR aggregate projects and CodSpeed build graph. The dedicated @benchmarks/react-link-performance targets require TSR_LINK_PERF=1 for discovery; disabled suites import no app. Gate tests cover explicit enablement and production environment selection.
Client batches perform eight navigations with 200 persistent measured Links. SSR batches create/load/render/dispose four fresh routers. Independent href, active-state, style, and history-state updater assertions run outside the measured loops. No production packages or dependencies change.
Compared identical sources on origin/main 28a5e4504e and captured HEAD bbaa7b3f29, with two fresh processes per ref/mode in counterbalanced order, 50 warm-up iterations, and 3-second windows. Full-suite results show lower HEAD client times for most cases (10.6% shared params, 13.2% search/hash/state updaters, 17.1% masks); SSR updater and optional cases show 14.8% and 12.4% reductions. These are whole-ref comparisons, not improvements from this benchmark-only commit.
Run-to-run noise is significant for small differences. Initial middleware and unique-param SSR slowdowns reversed in focused reruns, so they are not established regressions. Preserve both full-suite and focused data in the uncommitted experiment log and session artifacts.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* test(router): stabilize opt-in Link performance comparisons
Bound control navigation history with replace and assert that the measured anchors remain mounted. Share the exact setup, batch, and post-measurement assertions between normal Vitest benches and the paired comparison runner. Increase normal warm-up and measurement windows.
Add an opt-in stable runner with a fresh process per case/replica, separate router/app modules, one shared production React runtime, deterministic V8 random/hash seeds, alternating initialization order, and ABBA/BAAB fixed-work blocks. Record main-thread CPU, wall time, whole-process CPU, bundle hashes, and all raw blocks. Derive per-case 95% intervals from independent process replicas rather than correlated individual batches; require CPU and wall results to corroborate a direction.
Same-code controls exposed substantial noise in earlier methods. The selected control was centered near zero (client CPU -0.95%, SSR CPU -0.56%), with intervals still several percentage points wide. Keep unresolved measurements explicitly inconclusive instead of labeling them regressions.
Compared fixed runtime refs origin/main 28a5e4504e and bbaa7b3f29 across all 26 cases with four fresh-process replicas each: 16 cases support speedups, 10 remain inconclusive, and none support a slowdown in both metrics. Client middleware CPU: -5.95% [-13.89%, +2.73%]; SSR middleware: -16.06% [-31.65%, +3.09%]; SSR unique params: -5.08% [-14.97%, +5.96%]. These do not establish middleware or unique-param regressions.
No production package code or default CodSpeed workflow changes. Keep the complete raw matrix, calibration trials, snapshots, and detailed conclusions in uncommitted session artifacts and LOG.md.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* test: disable Maglev in CPU simulation benchmarks
* test: track shared CPU simulation flags in benchmark checks
* test: disable scheduled minor GC in CPU simulation
* test: keep incremental marking allocation-driven in CPU simulation
* test: release streamed benchmark data on counted task turns
* test: fix the initial heap budget for CPU simulation
* test: use eager baseline compilation in CPU simulation
* test: isolate each SSR workload in a fresh benchmark worker
* test: remove unnecessary marking override after runtime comparisons
* test: simplify benchmark setup after review
* bench(memory): settle-until-quiescent GC barrier between iterations
The fixed-turn settle before the pinned collection was hardware-fragile:
teardown needing one more event-loop turn on a given runner leaked a whole
payload of garbage past the collection point and flipped the measured peak
bimodally (serialization-payload solid/react resurfacing the pre-#7730
6.2MB attractor on some CI runners). Replace it with an adaptive barrier
that hops and collects until the post-GC heap size stops moving, with a
minimum-turn floor matching the fixed count it replaces (React's stream
teardown spans several turns and races a shorter floor).
Also pin collections in request-churn and the aborted-requests drain:
their peak floated on GC scheduling even with bit-identical work (18%
spread on CI for solid churn). Reachable accumulation stays visible to
the metric - a forced collection cannot reclaim leaked or cached objects,
it only removes floating garbage, whose collection timing was the
dominant cross-run noise source. Verified with a synthetic reachable
leak: +4.7% peak over a 0.6% A/A noise floor, where the old 18% noise
would have swallowed it.
Local A/A spreads (3x codspeed run per suite): solid <=1%, react <=2.2%
except request-churn (rare +130KB mode, framework teardown variance),
vue <=2.3% except aborted-requests (~8%, intra-iteration work variance,
down from 21% on CI).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* bench(memory): fixed-count settle barrier, drop adaptive quiescence exit
The adaptive exit (collect until post-GC heap size stops moving) made the
collection points land at data-dependent turns on CI: heap readings never
fully stabilize there, so the exit point - and every subsequent GC point -
shifted between identical runs. The first CI A/A pair showed it flipping
serialization-payload (vue) to a 6MB mode (67%), inflating peak-large-page
(vue) 3.4x, and adding 7-8% swings to the react/vue abort scenarios, while
fixing the solid suite.
Every step is now a fixed count: 16 settle turns (enough for React/Vue
multi-turn teardown that the original 2-turn barrier raced), one pinned
collection, one turn, one more collection for finalizer fallout. Fixed
counts make the GC points identical across runs by construction, which is
the property the barrier exists to provide.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* bench(memory): size iteration counts to the 2-10s measured-run window
On CI (eBPF instrument + --no-opt) one pinned iteration costs ~0.1-0.6s,
so the previous counts put request-churn at ~36s measured and the error
-paths/server-fn benches at 0.1-0.5s - outside the useful 2-10s range in
both directions. Retune: request-churn/aborted-requests/error-paths/
server-fn-churn to 40 iterations, serialization-payload to 12;
peak-large-page and streaming-peak already sit in range at 20.
The floor is raised by pinning error-paths and server-fn-churn rather
than inflating their iteration counts: thousands of unpinned iterations
would cross V8's own GC scheduling and reintroduce the timing noise the
barrier removes, while the pin's fixed per-iteration cost lifts them into
range at 40 iterations and makes their collection points deterministic.
Note: fewer churn iterations proportionally shrink the accumulation
window, so peak-based leak sensitivity drops accordingly; leaks remain
visible in total-allocated (forced compactions re-copy the growing live
set every iteration).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* bench(memory): disable V8 bytecode flushing in memory bench workers
The retuned (shorter) runs exposed a recurring V8 internal event - a
+7-13MB allocation burst with the signature of bytecode flush + lazy
recompile - that lands inside or outside the measured window at random,
flipping peaks by whole MBs between identical CI runs (request-churn vue
785KB vs 3.2MB). The pinned collections age code fast enough for V8 to
flush unused bytecode mid-run; --no-flush-bytecode keeps compiled code
alive for the process lifetime so the measured window sees no recompile
bursts. Vite's mergeConfig concatenates the scenario's test.execArgv with
the flags the CodSpeed plugin injects, so both apply to the fork workers.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* bench(memory): pre-size V8 heap geometry in memory bench workers
--no-flush-bytecode alone did not stop the run-to-run flips: the
recurring event is heap-space growth, which allocates several MB at a
run-dependent moment inside the shortened measured windows (error-paths
unmatched vue 674KB vs 2MB, serialization-payload solid resurfacing its
6.4MB attractor on one run in three). Pre-sizing old space and pinning
the semi-space size removes mid-measurement growth while leaving the
per-iteration page map/unmap signal intact - local runs confirm peaks
still track payload sizes exactly (serialization 3.5MB, streaming
30.3MB, levels unchanged).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* bench(memory): size tiny benches just above the 2s measured-run floor
error-paths and server-fn-churn sat at 5-8s measured on CI; fewer
iterations bring them to ~2.3-3.4s, keeping the 2s floor while shrinking
the window a stray allocator event can land in.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* bench(memory): verify the pinned collection against the heap floor
The residual CI flips all share one signature: exactly one iteration's
payload added to the measured peak (serialization-payload vue 3.5 vs
6.9MB, peak-large-page vue 780 vs 1349KB, error-paths redirect vue 300 vs
885KB). On some runners the response teardown holds the payload past the
fixed settle window - released only by a later internal timer - so it
survives the pinned collection and bleeds into the next iteration.
After the fixed 16-turn settle and collection, compare the post-GC heap
against the smallest post-collection size seen this run (the inter-
iteration floor): while it has not returned to the floor, keep hopping
and collecting, bounded at 64 turns. The barrier stays fixed-count in the
common case and extends only in exactly the failure case. Workloads that
genuinely accumulate reachable memory raise the floor as they go, so
accumulation still measures.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* bench(memory): restrict floor verification to peak-shape scenarios
The floor-verified barrier fixed its target - the serialization family
went to <=0.45% across three CI runs, attractor gone - but destabilized
churn/abort scenarios (request-churn solid 420KB vs 3.4MB): their inter-
iteration floor legitimately drifts, so the verification capped out
chronically and the ~48 extra collections per iteration eventually hit a
compaction that double-copies the live set. Split by scenario shape:
serialization-payload, peak-large-page and streaming-peak keep the
verified barrier (flat floor, proven fix); churn and abort scenarios go
back to the plain fixed-count barrier that held them at <=1.7% in the
two previous CI rounds.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* feat(benchmarks): add client-side CPU benchmark scenario suite
Add 11 client-side CPU benchmark scenarios to benchmarks/client-nav, each
implemented identically across react/solid/vue and tracked by CodSpeed
through the existing Benchmarks workflow (no CI changes needed):
async-pipeline, control-flow, head, history, links, loaders, mount,
nested-params, preload, route-tree-scale, search-params
Each scenario is an isolated file-based-routing app (route trees generated
by @tanstack/router-plugin) built for production and driven in jsdom by a
shared harness (scenarios/harness.ts): circular step sequences of real
<Link> clicks (plus hover/preload/history-traversal/invalidate steps),
each synchronized on the router's onRendered event, with a warm-up lap
that asserts every step's observable output. Determinism rules: no
wall-clock timers (counted 0ms hops only), staleTime/gcTime pinned to 0 or
1e9, deterministic preload staleness, stationary DOM and history depth.
The existing baseline apps and bench names are untouched for CodSpeed
continuity; baseline vite configs only gain an explicit root/setupFiles so
they resolve identically under the new per-framework aggregate configs.
Notable constraints encoded in the scenarios:
- Component-level Await/Suspense is excluded from async-pipeline: React 19
throttles every Suspense reveal by ~300ms wall-clock, which is
inherently non-deterministic to benchmark.
- control-flow/react silences React 19's onCaughtError reporting, which
otherwise dominates the measured loop with console I/O.
- Vue route components must be defined before their createFileRoute call
(bundled var hoisting silently yields component: undefined otherwise).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* ci: apply automated fixes
* chore(benchmarks): prefix client-nav bench names with "client-"
All benches in @benchmarks/client-nav now start with "client" so they are
easy to identify on the CodSpeed dashboard (the baseline already did).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(benchmarks): address review findings on client-nav scenario stability
Fixes from an adversarial review of the scenario suite:
- mount: create the browser history explicitly and destroy() it on unmount.
The default per-router createBrowserHistory() monkey-patches
window.history.pushState/replaceState, chaining one wrapper per router —
per-mount cost degraded 1.8ms -> 6ms over 3000 mounts (O(N^2) drift in
the cold-start bench). Verified flat (~1.86ms) after the fix.
- links: replace the five <MatchRoute> components with setup-scoped
useMatchRoute probes in all three apps. vue-router's MatchRoute calls
useMatchRoute() inside its render function, leaking one undisposed
watcher per render — the Vue bench accumulated ~5 dead subscribers per
navigation. Verified flat per-tick cost over 2000 ticks after the fix.
- all scenarios: bound the scroll-restoration cache with
getScrollRestorationKey: (location) => location.pathname. The default
key is a fresh random per-entry location key, so the module-level cache
grew one entry per push navigation for the whole run.
- harness hover step: dispatch a single mouseover instead of
mouseover+mouseenter. Solid/Vue attach intent-preload handlers to BOTH
events, so the old double dispatch ran the preload pipeline twice for
them but once for React. Verified all three adapters preload exactly
once per hover via cached-matches probes.
- README: correct the loaders row (the invalidate step means cached routes
re-run once per lap), the links row, and document the session-history
growth characteristics.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* feat(benchmarks): cover client rewrites, lazy route chunks, encoded params
Closes the three coverage gaps identified in the scenario-suite analysis:
- new `rewrites` scenario (react/solid/vue): router basepath '/app' composed
with a locale input/output rewrite pair — the client analog of the SSR
rewrites scenario. Every href build runs the output rewrite and every
committed location runs the input rewrite; assertions check both the
internal router pathname and the external window pathname. The harness
gained an `initialUrl` option since a basepath app cannot start at '/'.
- route-tree-scale now builds with `autoCodeSplitting: true`, so its
navigations also exercise lazy route-chunk resolution — the default shape
of real file-based apps, previously uncovered.
- nested-params and route-tree-scale param sets now include characters that
need percent-encoding (spaces, `&`, `%`, `+`, unicode) so the segment
encode/decode paths run on every navigation.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(benchmarks): reduce syscall time in measured loops, lengthen mount bench
CodSpeed excludes syscall time from simulation measures, and past a
threshold it warns ("cannot be consistently instrumented") and skips the
benchmark; the exclusion is also inconsistent run-to-run, which was the
root cause of the two same-code CI swings (route-tree-scale react 13%,
async-pipeline react 3.6%) and of skipped runs on hop-heavy benches like
async-pipeline solid (579 calls / 12.1ms).
- Replace all counted setTimeout(0) hops with setImmediate hops (harness
timerHop + async-pipeline hopDelay). Both are deterministic event-loop
turns that yield to timers and the React Node scheduler, but a timer
costs ~3-4 syscalls (timerfd + epoll) per hop vs ~1 for an immediate.
Same-machine instrumented before/after: preload solid 39.8ms -> 1.2ms of
syscall time, preload vue 30.1 -> 1.1, async-pipeline solid 23.5 -> 1.1,
async-pipeline vue 17.9 -> 0.9. head/route-tree-scale are unchanged
(their residual syscalls are GC/scheduler, and their measures were
already stable); history's syscalls come from jsdom's internal
timer-queued traversal and are not reachable from bench code (its
measured values are stable regardless).
- mount: 6 ticks per iteration instead of 2. A single mount simulates to
only ~8ms and very short measures amplify allocator/GC quantization;
the bench now measures ~50ms+ of simulated CPU.
All 39 benches pass; full nx typecheck green.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(benchmarks): stop history benches sleeping in jsdom's traversal timers
The history benches were skip-warned by CodSpeed for excessive syscall
time (5-26ms, highly variable across runs). Root cause: jsdom delivers
history traversals through two nested window.setTimeout(0) tasks, and Node
clamps zero timers to 1ms of wall time — so while awaiting onRendered
after back/forward/go, the event loop blocked in epoll_wait until each
timer expired. That blocked wall-time is recorded as syscall time, and its
duration depends on host timer behavior, hence the variability.
The harness now reroutes zero-delay window.setTimeout calls onto
setImmediate for the duration of a benchmark (non-zero delays pass
through; clearTimeout handles both). Zero-delay timeouts carry no ordering
semantics a check-phase immediate doesn't satisfy, and the suite's
conventions already forbid real-delay timers in measured code.
Instrumented A/A verification (2 runs per framework): history syscall time
react 23-26ms -> 2.5ms, solid 14-23ms -> 1.1ms, vue 11-12ms -> 1.2ms, with
bit-identical syscall counts across runs and measured values stable to
0.06%. The benches also stopped measuring sleep: locally an iteration
dropped from ~42-49ms to ~5-11ms of actual CPU work. All 39 benches pass.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* bench(memory): stabilize CodSpeed memory benchmarks
Memory flags on PRs were ~85% noise, from two causes:
1. Stale baselines (dominant): the Benchmarks workflow only ran on main
pushes touching packages/** or benchmarks/**. Main commits outside
those paths had no CodSpeed run, so PRs were compared against an old
base run ([^unexpected-base] on every recent codspeed-hq comment; six
late-June PRs all compared to the same June-23 run). One outlier base
measurement then replays into every PR until the next eligible push.
Fix: drop the paths filter for the push trigger + weekly cron backstop.
2. Wall-clock timers racing the single measured run: aborted-requests
(solid/vue) resolved deferred loader data on 500/750ms timeouts raced
against abort, and drained cancellation with at most one setTimeout(0);
streaming-peak staggered deferred sections by milliseconds. Under
variable runner load and instrumentation slowdown the interleaving —
and therefore the allocation sequence — differed run to run. Fix:
count 0ms timers-phase hops (event-loop turns) instead of milliseconds
everywhere async ordering must be staged, and drain aborts with a
fixed 8-turn settlement barrier.
Local before/after evidence (8 fresh-process runs per config, CodSpeed V8
determinism flags, idle + CPU-stressed; kernel peak RSS spread):
aborted-requests/solid idle 11.2MB -> 1.8MB (GC counts bit-identical)
aborted-requests/solid stress 7.7MB -> 2.5MB
streaming-peak/solid idle 6.2MB -> 2.5MB
request-churn/solid (untouched control): unchanged, confirming harness
streaming-peak/vue keeps ~2% proxy-level variance at any tick count; its
PR flags were the identical -3.2% in all three occurrences, i.e. the
stale-base artifact rather than per-run jitter.
Bench names and workload shapes are unchanged; absolute values will step
once on the CodSpeed dashboard from the removed cross-iteration overlap
(e.g. aborted-requests/solid retained 15.6MB -> 2.5MB per invocation).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* bench(memory): exclude docs/examples/e2e from main benchmark runs, drop cron
paths-ignore instead of no filter: docs/examples/e2e-only pushes cannot
affect benchmark results, and falling back across such a commit is safe
because the previous run's benchmark-relevant code is identical. The
weekly cron backstop is unnecessary for the same reason.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* bench(memory): pin GC between iterations in peak-shape scenarios
A/A runs of the real memory instrument showed the two big-payload peak
scenarios were still unstable with no timers involved: whether V8
collects iteration i's garbage before iteration i+1 allocates its
payload is not reproducible run to run, so the measured peak flipped by
a whole payload (serialization-payload solid: 6.8-9.2 MB across
identical runs; peak-large-page: 3.5-3.7 MB).
Peak scenarios measure the footprint of a single request, not
accumulation, so pin the collection points: settle two event-loop turns
(so trailing renderer/stream teardown is included) and force a GC after
each iteration. Peak then deterministically measures
max(single-request footprint). Churn scenarios are unchanged — their
signal is accumulation, which a forced GC would mask; the README rule
now spells out both sides.
A/A validation (3 identical instrumented runs, solid suite):
serialization-payload 6.8-9.2 MB -> 3.5-3.6 MB
peak-large-page 3.5-3.7 MB -> 754-757 KB (0.45% spread)
streaming-peak 38.5-39.5 -> 30.3/30.3/30.3 MB
churn scenarios unchanged (aborted-requests 1.4 MB x3)
Absolute values step because cross-iteration garbage no longer inflates
the peak; the new values are the per-request footprint the scenarios
were designed to track.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* fix(start-plugin-core): support rsbuild preview SSR
* fix(start-plugin-core): always install rsbuild SSR middleware in preview
Preview is the only SSR handler in `rsbuild preview`, so gate the opt-out
to dev only and keep the option named `installDevServerMiddleware`.