Repository navigation
perf: add conservative binding dirty masks and immutable provenance - #695
Merged
trueadm merged 1 commit intoAug 10, 2026
Conversation
domgan-oai
marked this pull request as ready for review
August 10, 2026 20:10
95 tasks done
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
filterprojections over private immutableuseState([])snapshots in production.tsrxcomponents.value/checkedrestoration.octanepatch changeset.Refs #673.
Correctness and scope
The compiler requires a genuine empty-array state initializer, a closed nonescaping setter, proven fresh array updates, pure own-data-property predicates, and nonescaping derived collections. The runtime guard runs only after existing memo dependencies already match and rejects non-native methods, overridden constructors/species, sparse arrays, indexed or item getters, and unproven snapshots.
Unsafe aliases, impure predicates, loose coercive conditions, side-effecting conditions, escaped derived arrays, arbitrary live receivers, development compilation, server rendering, and returned JSX retain their original behavior. Controlled fields continue to reassert their values on every commit.
Four independent public regressions were reproduced before fixing the proof: loose
Symbol.toPrimitivecoercion, earlier mutating predicates, side-effecting update expressions, and derived arrays escaping to unknown callbacks.Production work
The gate also checks all visible rows, keyed survivor identity, selection, editor state, footer totals, controlled-checkbox restoration, and necessary text updates. Generic root, Suspense, and hydration production bundles remain byte-identical; all 15 unrelated compiler-corpus entries and TodoMVC server output are unchanged. The optimized TodoMVC application grows by 355 gzip bytes, and its compiler-corpus entry grows by 145 gzip bytes. Session-to-session browser timings were too noisy to support a reliable duration claim; the deterministic work counters are the acceptance signal.
Validation
./node_modules/.bin/vitest run --project octane --project octane-prod --silent=passed-only— 804 files, 11,851 tests passed.pnpm --config.verify-deps-before-run=false --config.enable-pre-post-scripts=false run typecheck— complete workspace passed on the latest upstream base.git diff --check, andpnpm --config.verify-deps-before-run=false sync.Risk / follow-ups
Provenance
agent-authored)Note
Medium Risk
Touches production compiler memoization and DOM class binding lowering with a runtime snapshot guard; scope is intentionally narrow and heavily tested, but incorrect provenance could still cause stale UI if guards fail.
Overview
Adds compiler provenance so production
.tsrxcan wrap eligibletodos.filter((todo) => !todo.completed)-style projections in memoization when the array comes from a closeduseState([])with only proven-immutable setter updates and a simple own-property predicate. Generated memo paths call new runtimecompilerCacheImmutableArrayFilteronly on would-be cache hits to confirm dense plain snapshots (nativefilter/map, no getters/proxies/overrides) before reusing the filtered array identity.Class bindings from a single-key object like
class={{ selected: filter === 'active' }}can lower to a conditional string whenfilteris proven primitive state in the same component, reusing the existing binding dirty mask so unchanged filter tabs skip redundantclassDOM writes; controlledvalue/checkedstill reassert every commit.Docs describe the narrow contract;
benchmarks/todomvc/work.mjs(bench:work) is an untimed Chromium gate on the existing Octane TodoMVC build that asserts filter-predicate call counts, filter-tab class mutations, keyed rows, and controlled-field restoration. Extensiveauto-memotests cover hydration, getters, species overrides, escaped aliases, and impure predicates.Reviewed by Cursor Bugbot for commit d37c166. Bugbot is set up for automated code reviews on this repo. Configure here.