Repository navigation
perf: reuse nested implicit descriptor key prefixes - #1034
Merged
domgan-oai merged 3 commits intoSep 10, 2026
Merged
Conversation
domgan-oai
marked this pull request as ready for review
September 10, 2026 15:15
Closed
68 of 84 tasks
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.
Reviewed by Cursor Bugbot for commit 757053c. Configure here.
8 of 11 tasks
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
Nested unkeyed descriptor siblings currently serialize the same wrapper path for every leaf. Reuse its encoded prefix within one multi-child scope while retaining the existing reconciliation keys and DOM identity. This is the next bounded follow-up to #981's de-opt list key finding.
Changes
toJSON, and a serializer replaced after runtime initialization use full serialization.Validation
vitest run --project octane --project octane-prod --reporter=dot: 991 files passed; 17,640 tests passed and 14 expected failures.Focused key suite: 32/32 dev/prod tests. Deliberately unstable nested keys failed the four new mount/hydration cases; removing the array serializer guards failed both fallback cases. Both mutations were restored.
Octane and benchmark fixture
tsrx-tsc --noEmitchecks.Scoped Prettier check, benchmark JavaScript syntax checks,
git diff --check,pnpm changeset:check, andpnpm sync.Baseline/candidate minified production browser work gate against
d4bf228c864a33ca19ffeb0c2326e6592892ce33: identical complete HTML, row order, survivor nodes, uncontrolled input state, and focus.Existing unkeyed browser work gate: reproduced the obsolete-helper lookup failure, then passed both unchanged-main and rebuilt-candidate runs with strict helper counts and all DOM/input/focus controls.
After merging current main (
856febc73): 874 targeted key/Strong-mode tests and Octane typecheck passed. The rebuilt nested benchmark is byte-identical to the measured candidate and passes the work/semantic gate.Current-head CI: 26/26 jobs passed on
94d353e9b581f2b7cc79526f3273e3bd92002bbe. The first attempt had one five-second timeout in an unchanged Vite configuration test; that file passed locally (30/30), and the failed CI jobs passed on the unchanged-head retry.Cursor Bugbot passed on the current head; the unkeyed work-gate finding is fixed and its review thread is resolved.
Repository-wide
pnpm test,pnpm typecheck, andpnpm format:checkwere not run locally; the targeted checks above cover the changed runtime and fixture.Performance evidence
Per unrelated update in the isolated 1,000-row fixture:
The gate runs a transparent JSON observer separately from clean timing contexts. The normal minified fixture bundle grows from 165,458 to 165,876 bytes (+418); Node gzip grows from 53,254 to 53,418 bytes (+164). This supports a serialization-work reduction; no heap reduction is claimed. Reproduction commands are in
benchmarks/js-framework/README.mdunder “Nested de-opt list key work gate”.Quiet A–B–B–A confirmation (200 samples of eight updates per case, milliseconds per update):
Timing distributions overlap. The flat control also shares the changed helper; its equal median and p95 across these longer runs do not indicate a persistent common-path regression. No throughput improvement is claimed.
Risk / follow-ups
The cache is a local scalar that expires when the wrapper is flattened, with no retained state or rollback state to invalidate. Nested key strings are still created per leaf. The remaining explicit-key coercion, server nested-key work, and other #981 findings remain open.
Provenance
agent-authored)Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
Touches core child-list reconciliation key encoding; incorrect prefix reuse could cause wrong DOM adoption, though guards and extensive aliasing tests mitigate this.
Overview
Reuses a shared encoded wrapper-path prefix when deriving reconciliation keys for nested unkeyed de-opt list siblings, instead of calling
JSON.stringifyon the full[path, "index", index]tuple for every leaf.The de-opt key path is refactored from
scopedDeoptKeytoappendScopedDeoptKey, which lazily builds a prefix at the first implicit leaf in a multi-child scope and appends the index for later siblings. Top-level implicit keys stay numeric; explicitk…keys and full JSON serialization are unchanged when paths are non-primitive,Array.prototype.toJSONis customized, orJSON.stringifywas replaced after init. Single-child scopes and all-explicit lists skip prefix work viasingleDeoptKeywhere appropriate.Tests add nested keyed-wrapper reorders (client + hydration), escaped keys, and a custom array serializer fallback. Benchmarks add an opt-in
WORK_MODE=nestedPlaywright gate (nested vs flat vs fully explicit 1k-row lists, JSON call counts + timing) and extend the unkeyed gate forappendScopedDeoptKey. An Octane patch changeset documents the behavior change.Reviewed by Cursor Bugbot for commit 94d353e. Bugbot is set up for automated code reviews on this repo. Configure here.