Repository navigation
perf: stabilize client block shapes across boundaries - #990
Merged
domgan-oai merged 1 commit intoSep 8, 2026
Merged
domgan-oai merged 1 commit into
domgan-oai merged 1 commit into
Conversation
domgan-oai
marked this pull request as ready for review
September 8, 2026 11:10
Closed
68 of 84 tasks
7 of 8 tasks
14 of 21 tasks
7 of 8 tasks
domgan-oai
pushed a commit
that referenced
this pull request
Oct 7, 2026
…les (#1868) * docs(skills): add perf-review and hot-path V8, DOM, and scheduling rules Agent-written PRs now get one place that states the hot-path rules and one skill that checks a diff against them. - performance-audit gains three references grounded in runtime code: V8 shapes and allocation, DOM work without forced layout, and microtask/task scheduling (the #1864 megatask findings). It also gains an evidence table per kind of change and the local-load rule. - New perf-review skill: classify the diff hot or cold, read the mechanical candidates, judge each dimension, and require evidence. - scripts/perf-review-scan.mjs is the advisory scan behind it. Two invariants hold on main with zero hits: hot classes assign every declared field unconditionally in the constructor, and writes through Block/Scope receivers only target declared fields. On pre-#990 runtime the second finds all 13 shape-forking writes #990 fixed. Over the last 150 source commits the line rules report 44 candidate lines in 11 commits. - octane-core-extend, core-engineering, and create-a-pr route hot-path diffs through perf-review; the root rule lists its trigger. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(scripts): let perf-review-scan --diff accept fields the diff declares A pasted PR diff is scanned against the local checkout's runtime.ts. A PR that correctly declares a new BlockImpl field would then get a false hot-field-write for writing it, and the structural check would inspect the checkout instead of the reviewed head. Fields declared in the diff now count as known, and --diff leaves hot-class-shape to --head. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(scripts): diff perf-review-scan --head from the target's fork point Without --base, --head took the merge-base of the current checkout and main, then a second merge-base with the target. A checkout older than the target's fork point pulled unrelated main commits into the scanned diff. The base is now the merge-base of the target itself and main (or --base). The scan also resolves its repository from the working directory, so it runs from any subdirectory and against any checkout. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- 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
BlockImplfields at construction so ordinary, Suspense, Activity, and fetch-tree-warming blocks keep the same V8 object shape.undefineddefaults, existing assignments, and the previous order of all preexisting fields.Why
After #989 removed redundant native class-field definitions, ordinary blocks still gained two fields on first render. Suspense, Activity,
use(), and warm replay added more fields later, splitting the map at common Block read sites. A constructor-only shape probe on currentmainfound 53 own fields before render, 55 afterward, and 58 on a Suspense boundary, with different V8 maps. This PR pays for fixed slots on every block while keeping feature handlers and caches lazy.Changes
undefinedconstructor assignments for the nine late Block fields.octanepatch changeset.Validation
%HaveSameMapmatches across modes and all objects retain fast properties.git diff --check, and source-only behavior/shape probes.octaneandoctane-prod, lint, typecheck, Chromium integration, parity, and provenance.pnpm synccould not start after the package registry returned 403 during the frozen install.Risk / follow-ups
Every client Block carries nine additional enumerable internal fields, costing about 32 retained bytes. The source-only boundary timings are directional; a focused compiled Activity throughput comparison remains follow-up performance evidence. Code that reflects over private Block/Scope objects can observe the extra keys, though this is not a supported component contract.
Refs #981. Follows merged #989.
Provenance
agent-authored)Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
Touches core client
BlockImplallocation in the renderer with a small per-block memory cost; behavior is covered by a new boundary regression test but the change affects all blocks.Overview
Reserves nine optional boundary/render fields on every
BlockImplat construction (__warmEpisode, thenable/Suspense/try/Activity slots, warm cache, etc.) so ordinary renders, Suspense, Activity, and fetch-tree warming no longer grow the object shape on first use.Runtime comments now describe this as intentional:
__activitySlotstays on the common block shape instead of being treated as a rare expando. A new Vitest case exercises Activity + hidden Suspense retry—visible/hidden toggles, async resolve, reveal, DOM identity, and display styles—so boundary behavior stays correct with the unified shape. An octane patch changeset records the release note.Reviewed by Cursor Bugbot for commit 8fd3c16. Bugbot is set up for automated code reviews on this repo. Configure here.