Skip to content

[core] Reduce unnecessary compiler, hydration, async-discovery, and DOM-update work #673

Closed

Description

@domgan-oai

Summary

Track independently reviewable compiler and runtime improvements that eliminate avoidable work while preserving Octane's existing React-shaped public API, .tsrx/.tsx authoring model, hooks, context, Suspense, transitions, SSR, and hydration semantics.

Octane already provides compiled templates, direct DOM updates, automatic batching, dependency-stratified use(), keyed reconciliation, and cross-component async warming. The remaining opportunities are narrower: strengthen compiler proofs, reduce invalidation scope, avoid unnecessary request creation, and specialize proven DOM shapes.

Verified Octane-only baselines and gate semantics

The historical committed benchmarks/baselines/local/signal-favoring.json recording predates merged PR #685. Its pre-fix octane-tsrx-work and octane-jsx-work shallow-update recordings contain:

Recorded work .tsrx .tsx
Component block renders 10 20
Full child-slot dispatches 9 10
Lightweight child-slot dispatches 82 90
General child slots 0 9
Element descriptors allocated 0 19
Empty async-batch registrations 0 0
Actual DOM text writes 1 1

PR #685 fixed the .tsrx hookful-descendant cascade while preserving the unchanged .tsx control. Same-checkout production Chromium precise-call measurements now show:

.tsrx operation Block renders before → after Child-slot dispatches before → after DOM text writes
Shallow state update 10 → 1 91 → 0 1
Middle state update 5 → 1 41 → 0 1
Deep state update 1 → 1 1 → 0 1
Ten-state batched update 10 → 10 91 → 0 10

Mount retains its existing 19 blocks, 18 full component slots, and 82 lightweight component slots; teardown and JSX output/work are unchanged. Paired minified production sweeps improved from approximately 0.020 ms to 0.004 ms (5×), and both batch orders improved from approximately 0.008 ms to 0.004 ms (2×). These sub-millisecond timings are directional; the deterministic execution and DOM-write counts are the acceptance signal.

The separate GATES in benchmarks/signal-favoring/work.mjs remain upper ceilings on implementation work, not exact required behavior; visible text-write counts remain exact. PR #685 tightened the relevant .tsrx descendant-dispatch ceilings to zero without changing the JSX, mount, or teardown controls.

The historical committed benchmarks/baselines/local/memo-wall.json recording predates merged PR #684. Interpret it by wall rather than collapsing it into one aggregate:

Equal parent rerender Wall A Wall B
.tsrx ~0.000238 ms ~0.000277 ms
.tsx ~0.001326 ms ~0.182813 ms

PR #684 fixed the isolated .tsx wall-B admission while preserving wall A. Same-checkout production Chromium measurements and deterministic work gates show:

.tsx wall-B work Before #684 After #684
Equal-update keyed survivor visits 1,000 0
Equal-update shallow memo comparisons 1,000 0
Equal parent update ~0.1891 ms ~0.0010 ms (~188× faster)
Context-only update ~0.8000 ms ~0.6045 ms (~24% faster)
Changed-row update ~0.2580 ms ~0.2560 ms

Context-only updates still refresh exactly 1,000 leaves; changed updates still reconcile the changed row; context-restamping remains zero. Unrelated production bundles and the fixed 16-file compiler-output corpus remain byte-identical. Timing values are directional; deterministic execution, allocation, dispatch, and DOM-write counts remain the acceptance signals.

PR #687 subsequently extended returned-JSX region caching to the separate wall-A component shape while retaining its original provider and descriptor ownership. Same-checkout production Chromium measurements show:

.tsx wall-A work Before #687 After #687
Equal-update RowsA executions 1 0
Equal-update element descriptors 3 1
Context-update RowsA executions 1 0
Context-update element descriptors 1,003 1,001
Refreshed context leaves 1,000 1,000
Equal parent update ~0.001440 ms ~0.001032 ms (~28% faster)
Context-only update ~0.620 ms ~0.582 ms (~6% faster)

Changed-item and mount work remain unchanged, the fixed compiler-output corpus and unrelated production bundles remain byte-identical, and the eligible production fixture grows by approximately 125 gzip bytes. The remaining single returned-JSX fragment-wrapper descriptor was intentionally preserved.

PR #692 specialized proven .tsrx inline style objects containing a nonempty static prefix and exactly one dynamic declaration. Same-source production Chromium measurements on the existing 1,000-row benchmark show:

Existing 1,000-row operation Whole-style reconciliations before → after Dynamic property writes after Static declaration rewrites after
Mount 1,000 → 0 1,000 0
Select one row 1,000 → 0 1 0
Select another row 1,000 → 0 2 0
Unrelated update 1,000 → 0 0 0

Same-policy production-minified selection improved from approximately 2.0 ms to 0.7 ms while mount remained approximately 2.8 ms. The returned-JSX control, server output, and all 15 unrelated compiler-corpus entries remain byte-identical; the representative optimized application adds approximately 82 gzip bytes. Deterministic property-write, allocation, and DOM-adoption counts remain the acceptance signals.

PR #695 added conservative immutable-state provenance and per-binding dirty guards without changing the existing TodoMVC fixture. Production Chromium precise coverage and DOM mutation observation show:

Existing 100-todo interaction Filter predicate calls before → after Filter-tab class writes before → after Controlled checkbox writes after
Start editing 200 → 0 3 → 0 76
Cancel editing 200 → 0 3 → 0 76
Change active filter 200 → 100 3 → 2 26
Toggle a todo 200 → 200 3 → 0 1

Every interaction retains keyed row identity, exact visible lists/footer counts, editor behavior, and controlled-input restoration. Generic root, Suspense, and hydration production bundles, server output, and all 15 unrelated compiler-corpus entries remain byte-identical; the optimized TodoMVC application adds 355 gzip bytes, and its corpus entry adds 145 gzip bytes. Session-to-session timings were too noisy to support a duration claim, so deterministic execution and DOM-write counts are the acceptance signals.

PR #697 extended async-child discovery to proven bounded keyed lists. Converting the existing dashboard's independent activity and insights panels into a private keyed list exposed a real four-wave waterfall; same-source, production-minified Chromium measurements show:

Existing keyed-dashboard operation Before #697 After #697
Initial render latency ~213.15 ms ~108.40 ms (~49% faster)
Transition-update latency ~211.35 ms ~106.00 ms (~50% faster)
Request waves per operation 4 2
Independent first-wave requests 3 7
Initial resource-creator calls 18 8
Transition resource-creator calls 9 13
Actual deduplicated network requests 8 8
Mixed-version committed states 0 0

The 13 update creators restored the then-current two-wave dashboard baseline without introducing duplicate network requests; merged PR #701 subsequently eliminated that separate warm-reuse residue. The eligible production application adds approximately 13 gzip bytes, while server output, generic production bundles, and the fixed 16-file compiler corpus remain byte-identical. Deterministic request-wave, creator, network-start, and committed-DOM counts remain the acceptance signals.

PR #701 eliminated the promoted-transition warm-resource residue left by PR #697. Same-source, production-minified Chromium measurements show:

Existing keyed-dashboard transition work Before #701 After #701
Resource-creator calls 13 8
Duplicate resource-creator calls 5 0
Actual deduplicated network starts 8 8
Independent first-wave requests 7 7
Request waves 2 2
Mixed-version committed states 0 0

The five eliminated duplicate creators were badge, activity, activity-summary, insights, and insights-chart. They previously fired when the dependent owner request started, before it settled. Reuse is restricted to the owning transition tree and preserves real resource adoption, repeated equal-slot occurrences, independent roots, urgent supersession, and the entire committed dashboard.

The optimized async application adds approximately 72 gzip bytes; generic root, Suspense, and hydration production bundles and the fixed 16-file compiler corpus remain byte-identical. Fixed two-wave network latency makes duration differences inconclusive, so deterministic creator, request-start, and committed-DOM counts remain the acceptance signals.

PR #703 subsequently overlapped an eligible, genuinely code-split lazy module with the existing independent data wave. The same-source production Chromium gate delays the actual JavaScript chunk by 35 ms and records:

Existing keyed-dashboard lazy-module work Before #703 After #703
Lazy loader starts after mount ~106.5 ms ~1.3 ms
Actual split-chunk HTTP request starts ~106.9 ms ~2.4 ms
Split-chunk response ~145.3 ms ~40.1 ms
Lazy component becomes visible ~146.2 ms ~105.8 ms (~27.6% faster)
Lazy loader calls across mount and update 1 1
Actual lazy-module chunk requests 1 1
Data-resource creators per operation 8 8
Independent first-wave data requests 7 7
Data request waves 2 2
Mixed-version committed states 0 0

The roughly 40 ms visibility improvement comes from overlapping the intentionally delayed, separately emitted module with existing data work; data-only dashboard-ready and update timings remain unchanged within measurement noise. Dormant deferred-hydration chunks are never eagerly preloaded, and the loaded lazy component retains its DOM node across the transition. The affected application adds approximately 80 gzip bytes; static-root, hydration-root, deferred-hydration, Suspense-transition, and unused-pure-lazy bundles and the fixed compiler corpus remain byte-identical.

PR #704 completed the final delegated-event and ownership-safe marker work. Same-source, production-minified Chromium measurements show:

Existing delegated-event workload Before #704 After #704
Native bubbling input events 128 128
Controlled event-bearing hosts 512 512
currentTarget accessor installations 256 256
Distinct accessor descriptors 256 1
Distinct accessor getter functions 256 1
Distinct delegated capture-path arrays 128 1
Native capture callbacks 128 128
Native bubbling callbacks 128 128
Framework capture callbacks 128 128
Correctly updated controlled fields and outputs 128 128
Existing exhaustive-switch navigation workload Before #704 After #704
Deep-route comment nodes 4,093 1
Deep-route element nodes 2,052 2,052
Deep-route text nodes 1,025 1,025
Nested-route comment nodes 126 2
Nested-route element nodes 70 70
Nested-route text nodes 33 33
Unchanged returned-JSX control comments 0 0

Paired production navigation medians improved from approximately 2.0–2.1 ms to 1.5–1.7 ms while retaining route-shell and outlet identity. Event wall-clock samples were noisy, so no event-duration improvement is claimed; deterministic descriptor/getter/path identities and public dispatch semantics are the acceptance signals.

The fixed 16-file compiler corpus remains byte-identical at 153,572 raw / 75,799 minified / 26,823 gzip bytes, and server output remains byte-identical. The eligible event and switch fixtures grow by approximately 35 and 68 gzip bytes respectively; generic root, hydration, deferred-hydration, and Suspense production bundles grow by 23–51 gzip bytes.

The historical committed benchmarks/baselines/local/async-composition.json recording predates PR #701 and therefore still records 13 transition creators. The current production browser gate now enforces:

Async-composition work Initial render Transition update
Data-request waves 2 2
Actual data-request starts 8 8
Data resource-creator calls 8 8
Additional lazy-module loader calls 1 0 (cached)
Additional lazy-module chunk requests 1 0 (cached)
Mixed-version committed states — 0

Landed dependencies

  • PR #640 and PR #642 already merged destructured-prop and host-spread auto-memoization admissions.
  • PR #674 already merged conditional returned-JSX lowering into the template-control-flow pipeline; remaining returned-JSX work must be measured on top of it.
  • PR #676 already merged the transitive @if-arm single-root proof for static multi-hole host marker elision; remaining marker work must exclude that completed bucket.
  • PR #679 completed the false-async-warm-plan work below.
  • PR #683 completed the hydration-seed-before-request work below.
  • PR #684 completed the returned-JSX wall-B memoization-admission work below.
  • PR #685 completed the stable hookful-child call-site work below.
  • PR #687 completed the broader returned-JSX provider/component-region work below.
  • PR #692 completed the proven mixed static/dynamic inline-style work below.
  • PR #695 completed the conservative binding-dirty-mask and immutable-state-provenance work below.
  • PR #697 completed the bounded asynchronous keyed-list child-discovery work below.
  • PR #701 completed the transition warm-resource reuse and tightened creator-ceiling work below.
  • PR #703 completed eligible lazy-module discovery while preserving deferred hydration.
  • PR #704 completed the remaining delegated-event allocation and exhaustive-switch marker-elision work below.

P0: Avoid false asynchronous warm plans

Completed in PR #679.

The same-module async-reachability classifier previously treated ordinary destructured component parameters and member-expression prop reads as opaque. This made a synchronous child register an empty async batch and speculative warm plan despite having no asynchronous descendant.

Relevant symbols: classifySameModuleWarmPotential, warmCallsiteOwnsRequiredProps, buildWarmArtifacts, useBatch, and warmChild.

  • Recognize compiler-owned plain props objects, safe own-data property reads, and simple destructuring without defaults, rest, or computed keys.
  • Propagate proven synchronous reachability through same-module component trees.
  • Emit no empty async-batch registration or child-warming artifacts for fully synchronous proven trees.
  • Add realistic prop-reading and destructuring variants to the component-chain work benchmark.
  • Preserve conservative behavior for getters, proxies, spreads, imported/opaque components, custom hooks, unknown helpers, dynamic identities, effectful initializers, and component key/ref semantics.

P0: Consult hydration seeds before creating requests

Completed in PR #683.

Hydration previously adopted a serialized server result inside useThenable only after evaluating the client-side request creator. Eligible direct request factories can consult their server-proven ownership at the existing compiler-owned creation/memo hoist instead.

Ownership must be associated with the actual use() site and occurrence: independent creations can be hoisted before consumption, context-returning factories and externally owned promises do not produce Octane seeds, and the same component site can occur repeatedly with different ownership.

Relevant symbols: parallelUseMemoizePass, makeCreationMemoCall, lowerPuMemoDecl, server use, useThenable, HydrationCapability, and useBatch.

  • Introduce a hydration-aware compiler/runtime path that resolves the correct server seed before invoking an eligible request factory.
  • For seeded direct use(loadResource(...)) sites, invoke the client-side request creator zero times during hydration.
  • Associate seed ownership safely across hoisted independent creators, repeated source sites, and ordinary pre-created promises.
  • Preserve context reads, externally owned promises, rejection seeds, original consumption ordering, streamed chunks, nested boundaries, deferred hydration, and later dependency changes.
  • Preserve the existing compact wire format when no compiler-owned seed metadata is needed, and avoid retaining hydration machinery in client-only bundles.
  • Add request-creator counters to SSR/hydration coverage; correct DOM and absence of a fallback alone are insufficient evidence.

P1: Fix the returned-JSX wall-B memoization admission

Completed in PR #684.

The compiler now carries nonescaping auto-calculated array provenance through returned-JSX lowering, verifies that the active provider scope owns its context by identity, and memoizes the original static host descriptor. Array safety classification runs only when descriptor reuse can skip reconciliation; generated client-only memo slots are allocated after shared server/client hook slots.

Keeping the original descriptor representation preserves inspectable provider children, server markers, hydration node identity, and context-consumer ownership. Scope-identity checks avoid invoking custom provider getters or proxy traps.

Relevant symbols: compileReturnJsxFunction, collectAutoCalculatedRenderableRefs, autoMemoReturnedProviderChild, compilerOwnsContextProvider, compilerCacheArray, allocTailHookSymbol, useMemo, and tryImplicitBail.

  • Re-measure walls A and B on top of merged PRs perf(compiler): admit destructured props params into autoMemo regions #640, perf(compiler): admit host-element spread bags into autoMemo regions #642, and perf(compiler): lower conditional JSX returns to template control flow #674.
  • Identify and fix the narrow returned-JSX derived-array proof and provider-child descriptor admission failure.
  • Skip unchanged row bodies and keyed child-region traversal while reusing the existing host descriptor and retaining only unavoidable wrapper work.
  • Preserve context propagation, changed-row updates, keyed identity, provider ownership, refs, effects, Suspense, hydration, transitions, and custom provider accessors.
  • Add separate deterministic wall-A/wall-B work gates; require zero survivor visits, zero shallow comparisons, zero context-restamping, and exactly 1,000 context leaf refreshes where applicable.
  • Preserve byte-identical unrelated production bundles and the fixed compiler-output corpus; the eligible benchmark fixture grows by approximately 237 gzip bytes.
  • Validate 11,681 core tests, focused compiler/SSR/hydration coverage, full workspace typechecking, and both production-browser benchmark dialects.

P1: Skip stable hookful child call sites

Completed in PR #685.

A stateful descendant no longer automatically forces its unchanged parent call site to rerun. The production compiler proves narrow, synchronous, same-module useState subtrees and caches their existing lightweight or full component-slot calls without adding component blocks or changing runtime representations.

Module-private setter publication remains observable across multiple roots. Each cached edge therefore carries deduplicated transitive publication witnesses, snapshots their identities after the original child render, and re-enters the subtree if another root republishes a different setter. Unproven hooks, context/effect/Suspense ownership, custom comparators, keys, spreads, getters, proxy/property writes, and other side effects keep their existing fallback paths.

Relevant symbols: stableHookfulStateSetter, classifyStableHookfulChildCalls, classifySameModuleWarmPotential, makeCompCall, emitAutoMemoRegion, componentSlotLite, componentSlotVoid, and scheduleRender.

  • Separate “child owns hooks” from “parent must revisit this child call site” for proven synchronous state-only descendants.
  • Cache proven stable child call sites while retaining every child's independently scheduled block and the original lightweight/full slot representation.
  • Reduce shallow and middle component-chain updates to one owning-block render, zero descendant dispatches, and exactly one DOM text write.
  • Preserve ten independently scheduled batched state updates with zero descendant dispatches and exactly ten DOM text writes.
  • Preserve multi-root setter publication, independent child/store updates, context invalidation, refs, key changes, custom comparators, effect timing, Suspense retry, hydration, transitions, profiling, and HMR.
  • Keep mount/teardown work, the JSX control, and the fixed 16-file compiler-output corpus unchanged; the optimized minified fixture adds approximately 476 gzip bytes.
  • Validate 11,699 core tests, 1,701 focused compiler/runtime tests, 26 adversarial proof shapes, full workspace typechecking, and production-browser work/timing gates.

P1: Extend proven returned-JSX region caching beyond wall B

Completed in PR #687.

Merged PR #684 handled the direct-provider/static-host wall-B shape. PR #687 extends the proof to wall A's genuine context provider and private, same-module mapped child component while preserving the original returned-JSX descriptor representation.

The compiler admits only a nonescaping single-return host component with a keyed mapped child, stable dependency witnesses, and safe default memo boundaries. Its provider-owned memo slot reuses the original component descriptor only after Octane's existing native-array classification has proven the same immutable array snapshot safe.

The runtime's constant-time WeakMap-first guard rejects custom or overridden maps, sparse/indexed-accessor arrays, custom constructors/species, and own or inherited defaultProps without introducing new observable getter or proxy reads. Genuine provider ownership, context refresh, independent child state, refs, effects, keyed changes, SSR, and hydration retain their existing behavior.

Relevant symbols: collectPrivateMappedProviderComponents, autoMemoReturnedProviderChild, compilerOwnsContextProvider, compilerCacheMappedArray, mapSlot, allocTailHookSymbol, useMemo, and witnessOkChain.

  • Identify the remaining returned-JSX wall-A provider/component shape beyond merged PRs perf(compiler): lower conditional JSX returns to template control flow #674 and perf: skip unchanged returned JSX descriptor walls #684.
  • Carry proven native-array and private-component region ownership through an additional supported provider child without changing its descriptor ABI.
  • Eliminate unchanged/context-only RowsA execution and reduce wrapper descriptors while preserving exactly 1,000 refreshed context leaves.
  • Reuse provider-owned client-only memo slots only after proving scope ownership, stable dependencies, and server/client hook-slot compatibility.
  • Preserve fallback behavior for exported/aliased components, unmemoized or custom-comparator rows, fake providers, custom maps, getters, proxies, sparse arrays, species, and inherited defaultProps.
  • Preserve independently scheduled child state, context, refs, effects, keyed updates, original SSR DOM nodes, and subsequent hydration updates.
  • Add exact production-browser gates for wrapper execution, descriptor allocations, changed rows, context leaves, and unaffected wall-B/TSRX controls.
  • Keep unrelated production bundles and the fixed 16-file compiler-output corpus byte-identical; the eligible production fixture adds approximately 125 gzip bytes.
  • Validate 11,725 core tests, 1,821 focused compiler/runtime tests, 11 real-Chromium hydration tests, full workspace typechecking, and both production-browser benchmark dialects.

The single-return _frag wrapper ABI remains a distinct potential future optimization; this completed work intentionally retains its one observable descriptor boundary.

P1: Specialize mixed static/dynamic style objects

Completed in PR #692.

Direct .tsrx host style literals with a proven nonempty static prefix followed by exactly one dynamic property now lower into baked template CSS and a deferred, cached scalar property binding:

<div style={{ display: "flex", gap: 12, color }} />

Static declarations are emitted once in template order. The dynamic declaration retains existing sibling/child evaluation ordering and updates only when its scalar value changes, without allocating or reconciling a complete style object.

Exact template-relative partial-style metadata preserves development hydration for root hosts, nested hosts, fragments, and SVG without weakening genuinely static structural mismatch checks. Complete hydration comparison, suppression behavior, server output, original DOM identity, and transition rollback remain unchanged.

Each binding's existing previous-value slot starts with its private owning scope. This preserves static shorthand values when an initial dynamic longhand is absent while still removing a previously applied declaration when an unmounted suspended scope retries with null or a boolean; even a dynamic value indistinguishable from its baked shorthand is handled correctly without allocating extra binding state.

Relevant symbols: mixedStaticStyle, planJsx, emitBindingUpdate, setStyleProperty, applyStyleProperty, clone, hydrationNodeMatches, and HydrationCapability.applyStyle.

  • Bake compiler-proven static declaration prefixes into template HTML while preserving authored CSS ordering.
  • Emit deferred, cached per-property updates for one proven dynamic key without allocating a complete style object.
  • Perform zero whole-style reconciliations and zero static declaration rewrites on optimized mount/update paths.
  • Perform zero dynamic style writes for unchanged values, one targeted write for selection, and two writes when selection moves.
  • Fail closed for spreads, computed/accessor/duplicate keys, reordered declarations, direct hydration suppression, and unsupported returned-JSX descriptor paths.
  • Preserve shorthand interactions, CSS custom properties, numeric units, !important, null/boolean removal, SVG, source evaluation order, SSR, and hydration mismatch semantics.
  • Preserve nested/fragment/SVG hydration identity, genuinely static structural mismatches, and suspended-transition rollback.
  • Remove stale dynamic declarations after suspended initial-mount retries while preserving initially absent longhands and avoiding new allocations or binding slots.
  • Add exact production Chromium gates for the existing 1,000-row mount, selection, reselection, and unrelated-update workloads; retain the byte-identical returned-JSX control.
  • Keep server output and 15 unrelated compiler-corpus entries byte-identical; the optimized production application adds approximately 82 gzip bytes.
  • Validate 11,785 core tests, 2,699 affected compiler/style/hydration tests, full workspace typechecking, immutable parsed ASTs/source locations, and production-browser work gates.
  • Follow up in PR #695 with proven single-token class objects driven by primitive state; leave broader class-object ordering unchanged.

P2: Add conservative binding dirty masks and immutable-value provenance

Completed in PR #695.

The production .tsrx compiler now recognizes narrowly proven native filter projections rooted in a genuine useState([]) binding. Every state writer must remain private and produce a fresh, syntactically proven array snapshot; predicates may inspect only ordinary own-data properties, and derived collections must not escape to unknown consumers.

Existing inline memo cells retain the derived value behind its actual state dependencies. Only after those dependencies match does the runtime validate captured native filter/map, dense ordinary arrays, data-only item properties, constructor/species invariants, and unchanged snapshot identity. Mounts and changed snapshots therefore pay no speculative classification scan.

In the same proven component, a one-token class object driven by primitive state lowers to its equivalent ordered scalar and reuses the existing binding dirty guard. Controlled value, checked, and default/select projections remain intentionally unconditional so user-edited form state is restored on every commit.

Four observable hazards were reproduced and fixed before landing: loose equality invoking Symbol.toPrimitive, earlier predicates mutating a shared state snapshot, side-effecting conditional update expressions, and filtered collections escaping to unknown mutating callbacks. These shapes now fail closed instead of suppressing user code or displaying stale DOM.

Development/server compilation, returned JSX, arbitrary live member calls, untrusted state initializers/setters, getter/proxy receivers, sparse arrays, custom methods/species, escaping aliases, hooks, effects, context, and external-store updates retain their existing behavior.

Relevant symbols: collectImmutableStateProvenance, immutableArrayProjection, rewriteAutoCalculation, lowerAuthoredHookMemo, scalarStateClass, compilerCacheImmutableArrayFilter, and emitBindingUpdate.

  • Infer compiler-private state and predicate dependencies for proven immutable filter projections, derived lists, and single-token host class bindings.
  • Reuse unchanged derived-array values and skip unrelated filter evaluation/class writes while retaining component-body, hook, effect, context, and controlled-input behavior.
  • Cache only native nonmutating filter operations over closed, ordinary, immutable state snapshots with pure own-data predicates.
  • Fail closed for unsafe initializers/setters, mutable or escaping aliases, getters, proxies, sparse/indexed-accessor arrays, overridden methods, custom constructor/species, coercive or impure conditions, and escaped derived collections.
  • Preserve controlled value/checked restoration, keyed survivor identity, hydration adoption, SSR output, and all required visible DOM/text updates.
  • Add production Chromium gates on the existing 100-todo fixture: unchanged edits perform zero predicates/class rewrites; filter switches perform exactly 100 predicates/two writes; real todo changes retain 200 predicates.
  • Keep generic root/Suspense/hydration bundles and 15 unrelated compiler-corpus entries byte-identical; disclose the optimized application's 355-gzip-byte increase and target corpus entry's 145-gzip-byte increase.
  • Validate 11,851 core tests, 3,209 affected compiler/universal/hydration tests, 320 newly merged Lynx tests, 34 focused public regressions, frozen parsed AST/source locations, full workspace typechecking, and production-browser work gates.

P2: Discover eligible asynchronous keyed-list children earlier

Completed in PR #697.

The DOM-client compiler now discovers independently warmable async components behind a narrowly proven keyed @for. Its iterable must be a private, nonescaping module-level const array containing at most 16 distinct string literals, referenced only by that keyed list; the explicit key must be the item itself.

Eligible entries are unrolled statically into the existing lazy child-warming plans. No speculative iterable traversal, index/property lookup, key evaluation, new runtime API, extra hook slot, or loop-local hook is introduced. Each real child retains its ordinary keyed scope, warm-cache adoption, and existing Suspense/transition ownership.

Direct @try and safely guarded @if arms now reach the same collector, and statically decidable strict @else if chains select only their matching component. Dynamic/dependent iterables, mutations, aliases, direct eval, duplicate keys, holes, over-limit arrays, computed/effectful keys or props, and effectful outer conditions all remain fail-closed; @pending, @catch, and @switch arms are not speculatively warmed.

Relevant symbols: collectPrivateWarmLists, parallelUseWalkJsx, collectWarmListChildren, visitWarmListArm, isSafeWarmListGuard, buildWarmArtifacts, rewriteParallelUse, and keyed @for scope generation.

  • Generate bounded per-item warm plans for proven-safe keyed lists and independent request factories.
  • Start independent eligible child requests in the same discovery wave.
  • Keep truly dependent requests in their required later waves.
  • Preserve stable item keys/scopes, duplicate-key diagnostics, safe iterable provenance, request deduplication, abandonment, retries, transitions, and bounded concurrency/memory.
  • Add async-list workloads asserting request-start waves, creator counts, maximum fanout, and committed output.
  • Cover direct @try/@if arms, false conditions, strict item-keyed @else if chains, direct-evaluation escapes, and observable guard/prop side effects.
  • Restore seven first-wave requests and two total waves on the production keyed dashboard while retaining eight actual network starts, the then-current 8/13 creator ceilings, and zero mixed-version committed states; PR perf: reuse warmed transition resources #701 subsequently tightened updates to eight creators.
  • Keep server/universal output, generic production bundles, and the fixed 16-file compiler corpus byte-identical; the eligible keyed dashboard adds approximately 13 gzip bytes.
  • Validate 11,881 core tests, 3,259 focused compiler/runtime tests, 94 parallel-use tests, 40 adversarial proof shapes, immutable parsed AST/source locations, full workspace typechecking, and production Chromium work gates.

P2: Reuse warmed transition resources before tightening creator ceilings

Completed in PR #701.

Promoted transition retries previously started a fresh warm episode before descendant components could adopt resource identities harvested from the held transition. When the truly dependent owner request started its second wave, speculative warming recreated five existing resources even though application-level caching kept actual network requests at eight.

warmMemo now consults the existing held/promoted harvest only after its current-episode and active-real-memo paths miss. Existing slot/dependency identities and per-plan occurrence claims identify one concrete warmed resource; already-adopted entries remain occurrence tombstones, while real adoptWarmValue retains sole ownership of component adoption.

Harvest reuse is restricted to descendants of the transition's existing owning block, so independent roots with identical compiled slots, dependencies, and loader identity still start their own requests. Urgent supersession discards stale generations, and repeated equal-slot occurrences retain distinct component results.

The change adds no runtime allocation, cache bridge, hook field, public API, compiler output, or ordinary-render-path work. Generic production bundles and the fixed compiler corpus remain byte-identical; the affected async dashboard adds approximately 72 gzip bytes.

Relevant symbols: warmMemo, HELD_SYNC_TRANSITION, PROMOTED_WARM_HARVEST, ACTIVE_TRANSITION_ATTEMPT, CURRENT_WARM_CLAIMS, blockIsAncestor, adoptWarmValue, and deferred transition commits.

  • Preserve and reuse warmed resources across promoted/deferred retries while safely discarding stale generations.
  • Reduce transition-update resource creators from 13 to eight without increasing the existing eight actual network starts.
  • Tighten the existing production benchmark's update creator-call ceiling from 13 to eight only after runtime behavior reaches that floor.
  • Preserve seven independent first-wave requests, two total request waves, full keyed dashboard identity, and zero mixed-version committed states.
  • Restrict reuse to the owning transition tree without widening pending notifications, ordinary render work, or unrelated-root activity.
  • Preserve urgent supersession, stale-result isolation, nested transitions, async actions, optimistic updates, timeout fallback, effect order, repeated equal-slot occurrences, and independent roots.
  • Validate 11,953 core tests, 3,056 affected transition/runtime tests, 11 real-Chromium hydration tests, full workspace typechecking, same-source production-browser creator gates, and byte-identical generic bundles/compiler output.

P2: Preload eligible lazy modules without defeating deferred hydration

Completed in PR #703.

The DOM-client compiler already identifies independently reachable component children in its existing guarded Suspense warm plans, but lazy() wrappers previously exposed no warm capability. A preceding pending data component therefore delayed an otherwise independent dynamic module import until all required data strata had completed.

The client runtime now publishes the existing component warm capability on each lazy wrapper and shares one transactional payload initializer between speculative discovery and real rendering. Warming starts only the original cached dynamic loader; it never resolves a module default export, executes the component, runs hooks/effects, allocates DOM, or defeats bundler chunk splitting.

Loader identity remains shared across replays, ordinary mounts, transitions, and independent concurrent roots. False render guards and unopened <Hydrate> boundaries remain opaque. A real server-rendered never() island retains its original DOM and starts zero nested module requests even while an independently reachable outside sibling actively warms; explicit activation and prefetch keep their documented ownership.

Synchronous loader and subscription failures remain retryable. If a supported thenable fulfills or rejects synchronously and subsequently throws from subscription, the original exception is replayed exactly once on the first real render; later retries still observe the settled module or rejection without rerunning its loader.

No compiler, server runtime, public API, hydration-chunk extraction, or generic production bundle changes were required. The independently emitted lazy chunk remains 324 bytes, and the eligible application increases by approximately 80 gzip bytes.

Relevant symbols: client lazy, warmChild, the existing compiler buildWarmArtifacts reachability proof, shared lazy-payload initialization, Hydrate, and docs/deferred-hydration.md.

  • Start provably reachable lazy modules during the existing suspended sibling warm pass, overlapping actual code requests with independent data work.
  • Deduplicate lazy loader calls and real split-chunk requests across speculative discovery, rendering, replay, updates, hydration, and concurrent roots.
  • Preserve loader rejection, synchronous subscription failures, fulfilled/rejected-then-throw parity, render-time default-export accessors, component identity, chunk ownership, and bundler splitting.
  • Never eagerly module-preload intentionally deferred <Hydrate> chunks; preserve dormant server DOM, existing explicit prefetch, and activation-owned loading.
  • Measure actual lazy loader/request/response start times, visible component readiness, duplicate requests, cached transition identity, and unchanged data creator/wave/atomicity controls.
  • Keep generic static, Suspense, hydration, deferred-hydration, and unused-pure-lazy production bundles and the fixed 16-file compiler corpus byte-identical; disclose the eligible application's 80-gzip-byte increase.
  • Validate 11,988 core tests, 3,927 affected framework tests, 40 focused lazy-mode tests, 15 real-browser Vite production/SSR tests, 11 Chromium hydration tests, full workspace typechecking, and same-source delayed-chunk production gates.

P3: Reduce delegated-event allocations and remaining redundant markers

Completed in PR #704.

The client runtime now reuses one configurable accessor descriptor and getter for all delegated handlers. The getter reads its active target from the receiving native event, so simultaneous outer and nested dispatches retain independent currentTarget values. Each handler still reinstalls the accessor, preserving consumer replacement/deletion behavior, and both the public accessor and private target are removed when the dispatch ends.

Delegated capture reuses one stack-backed ancestor path. Each synchronous nested dispatch appends its own frame and restores its previous length in finally, retaining root-to-target ordering, portal hops, stopped propagation, throwing-handler isolation, controlled restoration, and subsequent bubbling.

The existing compiler-only single-root proof now also accepts an exhaustive @switch whose explicit @default and every case yield exactly one plain host or a previously proven same-module component. Both the ordinary and hookless classifiers use the existing fixed-point ownership channels. Missing defaults, empty/multiple roots, fragments, unknown identities, and direct or nested switch-local component shadows fail closed. The server compiler, marker wire protocol, streaming ownership, and hydration adoption remain unchanged.

Relevant runtime symbols: setCurrentTarget, clearCurrentTarget, dispatchDelegated, and dispatchDelegatedCapture. Relevant compiler symbols: collectSingleRootIfDeps, anchorlessRootShape, and the existing $$singleRoot proof.

  • Reduce per-handler event allocations while preserving native event identity, capture/bubble order, portals, nested dispatch, propagation control, currentTarget, and descriptor restoration.
  • Avoid unnecessary capture-path allocations when traversal can be proven equivalent.
  • Replace only remaining proven-redundant region markers after perf(compiler): transitive @if-arm single-root proof elides static multi-hole host markers #676; do not duplicate its completed proof.
  • Preserve empty ranges, fragments, sibling ordering, refs, portals, transition ownership, streaming SSR, and hydration adoption.
  • Reuse one accessor descriptor/getter and one nested-safe capture path while retaining all 256 handler accessor installations across 128 actual native input events.
  • Reject both direct and nested switch-arm lexical component shadows after reproducing real sibling-order regressions in development and production.
  • Restore deep/nested exhaustive-switch marker ceilings to one/two while preserving exact visible-node counts and the unchanged zero-comment JSX control.
  • Run the new self-contained allocation work target automatically after the existing six framework targets in the unified event-delegation benchmark.
  • Preserve exact server output and fixed compiler-corpus bytes while disclosing the affected and generic production bundle-size increases.
  • Validate 12,014 core tests, 2,822 affected framework tests, 30 real-Chromium hydration/SSR/event tests, the full workspace typecheck, 35 adversarial compiler proof shapes, frozen parsed AST/source origins, and production-browser work gates.

Cross-cutting acceptance criteria

  • No public API, authoring-contract, or observable compatibility changes.
  • Preserve hook-slot identity, conditional hooks, explicit dependency arrays, context, refs, native events, controlled inputs, keyed reconciliation, Suspense, transition atomicity, SSR, and hydration.
  • Maintain immutable parsed ASTs, source-map correctness, development diagnostics, and feature tree-shaking.
  • Add regressions to the package owning the behavior rather than app-level workarounds.
  • Distinguish recorded behavior from acceptance ceilings, and distinguish resource-creator calls from actual request starts.
  • Measure component renders, slot calls, expression evaluations, descriptor/style allocations, DOM writes, node counts, request waves, creator calls, emitted-code size, and runtime-bundle size.
  • Re-baseline affected workloads after prerequisite PRs merge; validate relevant existing suites, including signal-favoring, memo-wall, async-waterfall, async-composition, hydration-interactivity, event-delegation, codegen-size, bundle-size, and compiler-throughput.
  • Land changes as independently reviewable phases with same-checkout before/after measurements.

Activity

  1. deleted a comment from trueadm on Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions