Repository navigation
test(bench): add a Suspense-bounded app frame and trace its longest task - #2041
Merged
Merged
Conversation
The frame-boundaries scenario puts the app frame's 11 sections in Suspense boundaries. Each cold sample is now traced from hydrateRoot until every boundary's layout effects and the passive effects have run, and reports the longest main-thread task and the busy total. A sidebar click made right after hydrateRoot must still collapse its section. On main the scenario hydrates in one task; it is the gate for hydrating boundaries after the shell (#2028 step 5): longest task under 50 ms at 4x CPU, busy total flat. Co-Authored-By: Claude Opus 5.5 <[email protected]>
trueadm
marked this pull request as ready for review
October 13, 2026 12:03
13 of 14 tasks
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
View logs |
octane-website-mcp | c57e379 | Oct 13 2026, 12:06 PM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
View logs |
octane-website | c57e379 | Oct 13 2026, 12:06 PM |
…pp-frame-boundaries-bench # Conflicts: # benchmarks/app-frame-hydration/README.md # benchmarks/app-frame-hydration/run.mjs # benchmarks/app-frame-hydration/src/client.ts # benchmarks/bench.mjs
Contributor
Benchmark report🟢 No byte growth, no added work, and no timing changes beyond ±3%. Compares js-framework: 1k/10k row operationsAll 20 timed operations (20 without a verdict)
All 64 work counters are unchanged. Application bundle size (bytes)No changes across 93 measured values. Public-import reachability bundles (bytes)No changes across 120 measured values. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds
benchmarks/app-frame-hydration'sframe-boundariesscenario, plus trace-based longest-task and busy-total metrics. It is the gate for hydrating Suspense boundaries after the shell (#2028 step 5; policy decided on #1864). It changes no runtime code.Why
React 19 hydrates the shell in one task and each server-rendered Suspense boundary in later tasks, so a large page yields between boundaries. Octane hydrates every boundary inside the
hydrateRoottask. Theframescenario has no boundaries, so it cannot show the difference. This scenario can, and it gives step 5 a measured bar to beat.Changes
frame-boundariesscenario. The same app frame, with its 11 sections in Suspense boundaries: rail, sidebar header, shortcuts, three nav sections, sidebar footer, header, composer, suggestions and footer. ASettledlayout effect in each boundary counts its commit.longest_task_coldandbusy_coldops.hydrateRootuntil every boundary's layout effects have run.RunTaskevent.hydrateRootcall, and reruns, up to three attempts.meta.tasksis the median task count.hydrateRootreturns must collapse it.frame-plaintwin from test(bench): track native-read overhead with a plain app-frame twin #2037.BoundedSidebarandSettledalso have copies insrc/plain/, so the twin build keeps every exportframe.tsrximports.frame-boundariesis in the default scenarios besideframe-plain, and theframe/frame-plainratio now reads the same per-op samples.bench.mjsregistry note are updated.Baseline on
mainnode benchmarks/app-frame-hydration/run.mjs 15, with Chromium headless, 4× CPU and 15 cold samples per scenario, onmainat5594cb06ea:frameframe-live-sectionsframe-boundariesThese were measured on
mainat5594cb06ea, before #2037 addedframe-plain. After merging currentmain, a 2-round run passed all four scenarios,frame-plainincluded, withframe-boundariesstill one task (75.2 ms).On
main,frame-boundariesis one long task. Step 5 must reach a longest task under 50 ms at 4× CPU, with busy total flat against this base andframeunchanged.For comparison, the draft reference implementation #2040 measured 87.7 → 20.5 ms longest task and busy +3.8% in a 15-pair run against
mainbefore #2033.Validation
pnpm format:fileson the changed files, andpnpm sync(no generated changes).pnpm typecheck:fileson the bench sources. The only errors come frompackages/octane/src/runtime.server.ts,server/streamed-signals.tsanderror-codes.server.generated.ts, whichserver.tspulls in throughoctane/server.main's ownserver.tsproduces the same 51 errors.pnpm test,pnpm typecheckandpnpm format:checkwere left to CI.perf-review: not applicable. Benchmark only, with no runtime, compiler-output or binding hot path.concise-code:BoundedAppFrame,BoundedSidebar,Settled,hydrateFrameSettled,clickBeforeSettled, and the settle counters instate.ts.slice-probe.mjs, a near-copy ofrun.mjs. Its tracing is folded intorun.mjsinstead.Risk / follow-ups
hydrate_cold. It is the same for every candidate in a paired run.@octanejs/tanstack-routerneeded a fix in perf(octane): hydrate server-resolved Suspense boundaries after the shell #2040, because its transitioner assumes its match tree committed before the shell's layout effects. That assumption holds onmain, where every boundary hydrates inside thehydrateRoottask. The fix is needed only once boundaries defer, so it belongs with step 5 and is not in this PR.Provenance
agent-authored)🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.Note
Low Risk
Benchmark and fixture harness only; no production runtime, compiler, or hydration behavior changes.
Overview
Adds a
frame-boundariesapp-frame hydration scenario and extends the harness so cold samples can be judged on main-thread task shape, not justhydrateRoottime.The fixture introduces
BoundedAppFrame/BoundedSidebar, splitting the same UI into 11 Suspense boundaries with aSettledlayout effect that counts boundary commits.hydrateFrameSettledwaits for all boundaries (withhydrate-start/hydrate-settledmarks), andclickBeforeSettledchecks that an immediate sidebar click still works before later tasks run.run.mjstraces each cold hydration in Chromium, deriveslongest_task_coldandbusy_coldfrom the trace (with microtask folding and up to three retries when a long task is missing), records medianmeta.tasks, and runs the early-click gate once per scenario. Counted work and paired comparisons now use the settled hydration path; docs andbench.mjsnote the new scenario and ops. No Octane runtime changes—this is the measurement gate for deferring boundary hydration after the shell (#2028 step 5).Reviewed by Cursor Bugbot for commit c57e379. Bugbot is set up for automated code reviews on this repo. Configure here.