Repository navigation
perf: reuse staged transition updates - #947
Merged
domgan-oai merged 5 commits intoSep 3, 2026
Merged
domgan-oai merged 5 commits into
domgan-oai merged 5 commits into
Conversation
domgan-oai
marked this pull request as ready for review
September 3, 2026 21:04
14 of 21 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
Reuse staged transition update records instead of looking them up again in state/reducer setters and profiling paths. Batch selection stays after user updater code, preserving reentrant Actions and owner-render queue replay.
This builds on the transition ownership implementation merged in #949. Add eight behavioral cases covering nested and overlapping owners, held Suspense content, partial unmount, rejection recovery, and an updater that starts an Action. Extend the existing
transition-hooksbenchmark with seven native Map.get work guards.Performance evidence
Compared with main
613508303, using the same production fixture, compiler, dependencies, and 64-cycle phases:This removes one lookup per staged update in the measured phases. Counts cover the complete workload, including DOM/harness calls, and are separate from timing. All existing creation counters and semantic observations remain identical. The combined minified bundle shrinks by 15 bytes (203,020 → 203,005); gzip changes by +1 byte (64,354 → 64,355) and compiled fixture size remains 3,368 bytes.
Historical quiet A/B/B/A timings against
eff02711b, before the final main refresh, used the existing Node/happy-dom settings. The current-base revalidation repeated deterministic counts and bytes only. Functional-updater mean/median times (µs) were A1 1.753/1.583, B1 2.041/1.967, B2 1.674/1.562, A2 1.648/1.555. The first candidate run also slowed the unchanged click control (5.821 → 7.701 → 5.813 → 5.607 µs). All four runs passed semantic and counter gates; variability prevents attributing elapsed-time differences to this change. No elapsed-time improvement is established.Validation
d38d2f053(vitest run --project octane --project octane-prod --project octane-profile --maxWorkers=8).613508303, all 622 targeted transition/linked-state/profiling, form-action, audit, and SSR tests passed across 38 files; core typechecking passed. The prior revision also passed all 46 MCP tests locally and every CI check.eff02711b. Deliberately selecting the batch before the updater makes both dev/prod reentrancy cases fail; restored the candidate byte-for-byte and reran the full suite successfully.pnpm syncpassed.cf93895ac, including core test shards, React parity, website/browser integration, lint, typechecking, examples, package validation, and provenance. Bugbot completed with no issues. The branch includes live main613508303and GitHub reports no conflicts; human review is still required.Risk / follow-ups
The runtime changes only internal staged-record plumbing. The new Map.get census restores the native method in
finally, and timing remains uninstrumented. Lookup counts are deterministic work evidence, not retained-memory or application-latency measurements. No public API changes.Provenance
agent-authored)Note
Low Risk
Internal transition staging plumbing only; batch selection still runs after user updaters, with new behavioral tests and deterministic benchmark guards limiting regression risk.
Overview
stageTransitionValuenow returns the stagedTransitionActionUpdate(ornull) instead of a boolean, so state, reducer, and profiling paths reuse that record instead of callingbatch.updates.get(slot)again after staging.The transition-hooks benchmark gains an untimed
Map.prototype.getcensus during observed drives, seven_map_getsratio guards inratios.json,bundle_minifiedreporting, and timing that runs before any native override. Docs record one fewer lookup per staged-update cycle with unchanged creation semantics.Eight new transition ownership tests (fixture +
transition-ownership.test.ts) cover overlappinguseTransitionowners, held Suspense, partial unmount, Action rejection, and starting an Action from a functional updater.Reviewed by Cursor Bugbot for commit cf93895. Bugbot is set up for automated code reviews on this repo. Configure here.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.