Repository navigation
perf(octane): skip the warm-plan stack restore when a render registered no plan - #1666
Merged
Merged
Conversation
…ed no plan renderBlockInner and the lite component path restored the warm-plan stack on every exit by storing ACTIVE_WARM_PLANS.length, although most renders register no plan and leave the length unchanged. A V8 line profile of repeated memo-wall one_change_B attributed about 5% of samples to that store. Both sites now compare first. Paired same-runner A/B against main (three runs, each build served twice, so every op has six A/B and six same-build estimates): memo-wall one_change_B 0.87x, ctx_through_wall_A/B 0.95x, recursive-context update_root 0.95x and update_partial 0.96x, all six estimates below the same-build spread. Memo bails that render nothing stay at exactly 1.00x; mount and js-framework stay inside the same-build spread, and js-framework work counters are identical. +17 raw bytes per client bundle. The test pins that a frame's warm plan ends with its render: a descendant that later re-renders alone and suspends must not start the frame's other requests again. Inverting the full-frame guard makes both cases start the leaf request twice. Co-Authored-By: Claude Opus 5.5 <[email protected]>
trueadm
marked this pull request as ready for review
October 3, 2026 11:41
This comment has been minimized.
This comment has been minimized.
Contributor
Benchmark report
Compares js-framework: 1k/10k row operationsAll 20 timed operations (20 without a verdict)
All 64 work counters are unchanged. Application bundle size (bytes)
10 other measured values are unchanged. Public-import reachability bundles (bytes)
36 other measured values are unchanged. |
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 3, 2026
Merged
trueadm
added a commit
that referenced
this pull request
Oct 3, 2026
Main gained #1685, which raised 51 budgets for the useLayoutSnapshot commit-phase priority fix (#1686), and #1681/#1665. Re-measured on main 425a32a: each of #1663, #1664 and #1666 merged alone, and all three plus #1686 merged together. Each budget is the larger of main's value and the largest measured value plus 32 (raw/gzip) or 256 (brotli), so the three perf PRs and #1686 can land in any order. Co-Authored-By: Claude Opus 5.5 <[email protected]>
trueadm
added a commit
that referenced
this pull request
Oct 3, 2026
…nd warm-plan perf PRs (#1687) Three open runtime perf pull requests fail the PR bench byte gate on main 12c32ec, and landing any two of them stacks past the 32-byte headroom: - #1664 (de-opt survivor fast path): +809 raw / +290 gzip in the bindings app framework chunk, which #1676 did not raise because #1639 added that budget key first; +20 raw in every compiled-only app. - #1666 (warm-plan length guard): +17 raw in every client bundle, two `!==` guards. - #1663 (scoped-value read-once): +2 raw / +30-70 gzip in descriptor-renderer bundles, a compression shift from the restructured childSlot reads. Main had already spent part of the headroom: bindings framework gzip measured exactly its budget and deferred-hydration raw had 8 bytes left. Each budget is set to the largest value measured across each PR merged alone with main and all of them merged together (plus #1665, which moves none of these values), plus 32 for raw and gzip and 256 for brotli. Only values one of those trees exceeds change. Co-authored-by: Claude Opus 5.5 <[email protected]>
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
renderBlockInnerand the lite component path (componentSlotLite) restore the warm-plan stack on every exit withACTIVE_WARM_PLANS.length = warmPlanCheckpoint. Most renders register no plan, so the length is usually unchanged. A V8 line profile of repeated memo-wall__oneChangeBattributed about 5% of samples to that line, on this build and on the #639-era build (73b22fd).Both sites now compare first:
The behavior is unchanged, because the store did nothing whenever the lengths were equal.
Evidence
Paired same-runner A/B against
main(ac729dc): Bench run 37119169008 onscratch/ab-warm-plan-guard. That branch is never merged, and its onlypackages/difference from main is this guard.octane-tsrxfixtures are built from both trees, and each build is served twice. Every op calibrates one ~20 ms batch, and each sample round visits all four pages in rotating order.The ratios are head/base, so values below 1 mean the guard is faster. The bracketed intervals are bootstrap intervals over all 360 pairs. They ignore correlation within a run, so the six-estimate ranges are the more honest spread.
partial_cycleandone_change_Astay inside the same-build spread. memo-wall remount reads 1.010 pooled, but its range (1.00–1.04) overlaps its same-build range (0.99–1.03), so no regression is shown.benchmarks/js-framework/pair.mjs, 40 pairs, with a head-vs-head A/A run): every op stays inside the A/A spread.calls_*,dom_*and mount counters match.Bundle bytes:
bundle-sizeandbundle-reachabilitywere built locally against both sources. Every client bundle grows by +17 raw bytes. gzip moves −5 to +22 and brotli −59 to +129, which is minifier noise. Server bundles are unchanged.Validation
pnpm format:check: not run.pnpm format:files:checkpassed on the changed files.pnpm typecheck: not run.pnpm typecheck:filespassed on the new test and fixture.pnpm test: left to CI.vitest run --project octane packages/octane/tests/warm-plan-checkpoint.test.tspasses. The same file plusparallel-use.test.tsandwarm-plan-reentrancy.test.ts(67 tests) passed during the break checks.The new test,
warm-plan-checkpoint.test.ts, mounts a frame whose plan warms a leaf. A descendant then re-renders alone and suspends. That must not run the finished frame's plan, which would request the leaf again. The test covers a full frame and a lite frame.Full-frame guard inverted (
===): both cases fail and startleaf:1twice.Lite-path guard inverted alone: the tests stay green, and so do
parallel-useandwarm-plan-reentrancy. That restore is redundant today, for two reasons:renderBlockInnerframe (including@trybodies, which render throughrenderBlock). That frame restores to an equal or lower checkpoint before any later episode.So inverting the lite-path guard cannot change what a consumer sees.
Risk / follow-ups
scratch/ab-warm-plan-guard, which is not to be merged.Provenance
agent-authored)🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Low Risk
Micro-optimization with identical semantics when stack length is unchanged; new tests guard warm-plan scoping on suspend paths.
Overview
Render exit no longer always writes
ACTIVE_WARM_PLANS.length. On both the main render path (renderBlockInner) and the lite component path, the runtime used to reset the warm-plan stack on every frame exit even when most renders never push a plan. It now restores only whenACTIVE_WARM_PLANS.length !== warmPlanCheckpoint, which is a no-op when lengths already match but avoids the cost of redundant length stores on hot paths.A changeset notes measurable wins on memo-wall and context-heavy benchmarks. Regression coverage adds a fixture plus tests (full and lite frames) that assert a finished frame’s warm plan does not keep warming sibling/leaf requests when a descendant re-renders alone and suspends—behavior that depends on the checkpoint restore still happening when the stack actually grew.
Reviewed by Cursor Bugbot for commit 144bf67. Bugbot is set up for automated code reviews on this repo. Configure here.