Skip to content

perf: cache stable renderable regions and prune sync warming - #634

Merged
domgan-oai merged 2 commits into
octanejs:mainfrom
openai-oss-forks:feat/compiler-memo-wall-signal-performance
Aug 8, 2026
Merged

domgan-oai merged 2 commits into
octanejs:mainfrom
openai-oss-forks:feat/compiler-memo-wall-signal-performance

Conversation

@domgan-oai

@domgan-oai domgan-oai commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Cache compiler-proven immutable renderable regions so unchanged memo-wall rows avoid reconciliation without sacrificing context, hydration, transition, Activity, or Suspense behavior.
  • Bring safe derived-calculation caching to hookful return-JSX components.
  • Remove fetch-warming scaffolding from same-module component trees proven entirely synchronous while preserving real asynchronous prefetching.

Why

Memo-wall previously traversed and compared all 1,000 unchanged descriptor rows on every parent update, while return-JSX rebuilt 1,001 descriptors. Signal-favoring registered 100 empty asynchronous warming plans during mount and 92 more during each shallow update even though its entire component graph is synchronous.

Changes

  • Add conservative compiler-owned renderable-region caching with lazy dense-array classification, explicit memo-ancestor context restamping, and cold-path effect reconnection.
  • Reject indexed getters, nested arrays, Fragments, scoped JSX descriptors, escaping or mutable arrays, reassigned component bindings, opaque callbacks, and other unproven structures.
  • Add observable regressions for context propagation, hydration, child-owned state, reordering, array/text transitions, Activity/Suspense effects, held transition rollback, deferred descriptors, and asynchronous warming.
  • Tighten deterministic memo-wall and signal-favoring work gates, including a zero-restamp guard protecting existing JSX fast paths.
  • Add the required patch changeset for octane.

Performance

Matched production builds, 20 samples, identical Node.js and Chromium:

Scenario Before After Change
Memo-wall TSRX unchanged update 0.11055 ms 0.000309 ms 358× faster
Memo-wall TSRX context update 0.49115 ms 0.37958 ms 22.7% faster
Memo-wall JSX unchanged update 0.27750 ms 0.20948 ms 24.5% faster
Signal-favoring TSRX sweep 0.02950 ms 0.02050 ms 30.5% faster

The official nine-framework memo-wall run places Octane's unchanged TSRX operation 5.96× ahead of React Compiler. Signal benchmark generated output shrinks from 70,712 to 52,064 bytes (26.4%) and from 4,168 to 3,362 bytes gzipped (19.3%); the complete signal bundle is 1,699 bytes smaller gzipped. The existing 16-fixture code-generation corpus is byte-for-byte unchanged.

Validation

  • pnpm format:check — repository-wide formatting was not run; explicit Prettier checks passed for every changed file.
  • pnpm typecheck — repository-wide typechecking was not run; the complete Octane package and scoped compiler/runtime/new TSRX fixture checks passed.
  • pnpm test — the root monorepo wrapper was not run; both complete Octane development and production projects passed.
  • NODE_NO_WARNINGS=1 pnpm_config_verify_deps_before_run=warn pnpm sync
  • NODE_NO_WARNINGS=1 ./node_modules/.bin/vitest run --project octane --project octane-prod --maxWorkers=4 --testNamePattern '^(?!.*transforms installed raw Octane packages)' --silent=passed-only --reporter=dot — 772 files, 10,901 tests passed; two instances of an existing broken external-workspace-link case were skipped.
  • Post-rebase targeted development/production regressions, keyed reconciliation, SSR, public exports, frozen ASTs, source maps, and universal compiler capabilities — 433 tests passed.
  • Final latest-upstream development/production smoke, including the newly merged bootstrap side-effect contract — 312 tests passed.
  • NODE_NO_WARNINGS=1 ./node_modules/.bin/tsgo --noEmit -p packages/octane/tsconfig.json
  • pnpm_config_verify_deps_before_run=warn pnpm typecheck:files packages/octane/src/compiler/compile.js packages/octane/src/index.ts packages/octane/src/runtime.ts packages/octane/tests/_fixtures/auto-memo-value-position.tsrx
  • Explicit changed-file prettier --check, git diff --check, and node scripts/check-changesets.js.
  • pnpm_config_verify_deps_before_run=warn node benchmarks/bench.mjs --ratios memo-wall signal-favoring — 11/11 ratio guards passed across 17 production framework targets.
  • pnpm_config_verify_deps_before_run=warn node benchmarks/bench.mjs --quick --ratios async-waterfall — 6/6 ratio guards passed.
  • pnpm_config_verify_deps_before_run=warn node benchmarks/bench.mjs --quick --ratios bundle-reachability — 30/30 raw, gzip, and brotli budgets passed across all ten public-import scenarios.

Risk / follow-ups

  • Changed-row memo-wall updates are approximately 6–7% slower; memo-wall bundles grow by 547 bytes gzipped for TSRX and 832 bytes for JSX.
  • Array safety classification is deferred until an actual repeated-identity cache hit; legacy mapped caches never opt into the new context-restamping walk.
  • Further signal improvements would require a separate proof for skipping lightweight component-slot traversal while preserving independently scheduled state updates and context propagation.

Provenance

  • An agent produced this diff (agent-authored)

Note

High Risk
Touches core compiler lowering and runtime reconciliation/context/effect paths; incorrect cache eligibility or restamping could cause stale UI or missed updates across memo, Suspense, and Activity flows.

Overview
Adds compiler-owned caching for immutable renderable child regions (dense descriptor arrays that never escape setup) so unchanged memo-wall-style lists skip keyed reconciliation while context consumers, hidden-tree effects, hydration, Activity, Suspense, and transitions still update correctly via extended compilerCacheContext / restampCachedContextScope and cold-path effect reconnection.

The compiler proves non-escaping auto-calculated holes (collectAutoCalculatedRenderableRefs), gates cache emission with runtime compilerCacheArray safety checks (rejecting getters, nested arrays, Fragments, scoped descriptors, etc.), and enables auto-calculation for return-JSX only after an authored Octane hook establishes a render scope. Hook detection now treats UNSTABLE_ like unstable_.

Fetch-warming is omitted for same-module trees classifySameModuleWarmPotential proves entirely synchronous; opaque or async-reachable graphs stay conservative.

Benchmark work gates and new fixtures/tests cover memo-wall TSRX/JSX expectations, signal-favoring useBatch counts, and regressions for context, reorder, array↔text round-trips, and parallel-use warming edges.

Reviewed by Cursor Bugbot for commit 2cee1cf. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent perf PR: performance work labels Aug 7, 2026
@domgan-oai
domgan-oai marked this pull request as ready for review August 7, 2026 23:57
@domgan-oai
domgan-oai merged commit 081fa1e into octanejs:main Aug 8, 2026
34 checks passed
jonkwheeler pushed a commit to jonkwheeler/octane that referenced this pull request Aug 8, 2026
…s#634)

* perf: cache stable renderable regions and prune sync warming

* fix: preserve uppercase-prefixed custom hook state
jonkwheeler pushed a commit to jonkwheeler/octane that referenced this pull request Aug 8, 2026
…s#634)

* perf: cache stable renderable regions and prune sync warming

* fix: preserve uppercase-prefixed custom hook state
jonkwheeler pushed a commit to jonkwheeler/octane that referenced this pull request Aug 8, 2026
…s#634)

* perf: cache stable renderable regions and prune sync warming

* fix: preserve uppercase-prefixed custom hook state
jonkwheeler pushed a commit to jonkwheeler/octane that referenced this pull request Aug 8, 2026
…s#634)

* perf: cache stable renderable regions and prune sync warming

* fix: preserve uppercase-prefixed custom hook state
jonkwheeler pushed a commit to jonkwheeler/octane that referenced this pull request Aug 8, 2026
…s#634)

* perf: cache stable renderable regions and prune sync warming

* fix: preserve uppercase-prefixed custom hook state
jonkwheeler pushed a commit to jonkwheeler/octane that referenced this pull request Aug 8, 2026
…s#634)

* perf: cache stable renderable regions and prune sync warming

* fix: preserve uppercase-prefixed custom hook state
jonkwheeler pushed a commit to jonkwheeler/octane that referenced this pull request Aug 8, 2026
…s#634)

* perf: cache stable renderable regions and prune sync warming

* fix: preserve uppercase-prefixed custom hook state
leonidaz pushed a commit that referenced this pull request Aug 9, 2026
* feat: add Solana React binding

* refactor(solana-react): stabilize wallet snapshots

* fix(solana-react): address preflight review findings

* chore(evals): refresh corpus lockfile hashes

* Address PR review feedback (#387)

- version reactive client snapshots
- normalize omitted query options compiler slots

* style(solana): format hook-slot fixes

* fix(solana): defer reactive subscriptions to consumers

* feat(playground): showcase solana client context

* fix(solana-react): stabilize derived hook slots

* chore(evals): refresh solana playground digest

* fix(solana-react): replace clients during render

* chore: refresh package inventory

* chore: refresh binding parity gaps

* chore: refresh binding status inventory

* fix(solana-react): keep null request queries idle

* style(solana-react): format null query guard

* fix(ci): retain trusted Octane peer resolution

* fix(solana-react): validate capabilities before cancellation

* fix(ci): stabilize merged RainbowKit hydration checks

* chore(solana-react): refresh package inventory

* fix(solana-react): make package tests cwd-independent (#387)

* fix(solana-react): stabilize idle refetch

* chore(solana-react): refresh parity gap index

* chore(solana-react): refresh bindings status

* chore(solana-react): refresh merged inventories

* fix(solana-react): treat superseded sign failures as cancellation

Check active generation and context before wrapping sign errors as signing-failed.

Co-authored-by: Cursor <[email protected]>

* fix(website): list solana-react once in Web3 bindings catalog

Remove duplicate @octanejs/solana-react entry from AI/data section;
Web3 is the correct category per Bugbot review.

Co-authored-by: Cursor <[email protected]>

* chore(ci): refresh react-parity evidence after main merge

Regenerate lockfile hashes and inventory for solana.

* perf: add minimal-import bundle reachability budgets (#631)

* perf: add minimal-import bundle reachability budgets

* fix: register reachability benchmark with MCP server

* fix: preserve side-effect-only bootstrap entrypoints (#633)

* perf: cache stable renderable regions and prune sync warming (#634)

* perf: cache stable renderable regions and prune sync warming

* fix: preserve uppercase-prefixed custom hook state

* fix(benchmarks): remove js-framework DOM node metrics (#636)

* fix(bindings): classify production bundle side effects (#637)

* feat: enable React Compiler across framework benchmarks (#639)

* perf: reduce core runtime and compiled application bundles (#638)

* chore(ci): refresh react-parity evidence after main merge

Regenerate lockfile hashes and inventory for solana.

* fix(solana-react): stabilize null-source query result identity

Cache the idle useRequestQuery result object and update it in place when
the underlying TanStack result changes, preserving referential stability
across parent re-renders.

Co-authored-by: Cursor <[email protected]>

* chore(ci): refresh inventories after main merge

Keep generated package/binding inventory and eval corpus digests current after merging origin/main into the solana-react binding branch.

Co-authored-by: Cursor <[email protected]>

* feat(solana-react): add React parity evidence lanes

Wire packages/solana-react into the generic react-parity:check path with a
vendored @solana/[email protected] pin, pristine/adapted runtime lanes, and
repo-authored type probes, while keeping Octane-only conformance outside
parity ownership.

Co-authored-by: Cursor <[email protected]>

* fix(solana-react): expand pristine/adapted parity for query and types

Address leonidaz feedback: run useRequestQuery in the pristine suite with
per-file dispositions and omission/rename controls, adapt the overlapping
cases, and replace repo-authored type probes with upstream __typetests__
lanes plus assertion-group inventories.

Co-authored-by: Cursor <[email protected]>

* fix(solana-react): prefer reactiveStore over send for Kit sources

PendingRpcRequest duck-types expose both APIs; dispatch through
reactiveStore().withSignal so getAbortSignal composition matches upstream.

Co-authored-by: Cursor <[email protected]>

* fix(solana-react): one-for-one adapted parity and expanded type lane

Preserve every selected pristine runtime identity in the adapted suite,
expand the pristine type lane across wallet/transaction/query typetests
with machine-checkable dispositions, and reject thenable ClientProvider
clients at mount.

Co-authored-by: Cursor <[email protected]>

* fix(solana-react): pin pristine-only typetests in type inventory

Include every adapted and pristine-only upstream typetest in
pristine-types.json so assertion-group drift is caught for wallet,
signing, request, and deferred query artifacts.

Co-authored-by: Cursor <[email protected]>

* fix(ci): refresh vitest parity hashes and format solana-react audit

Keep neighbor react-parity manifests aligned after vitest.config.js changed for solana-react lanes, and satisfy Prettier on the new audit file.

Co-authored-by: Cursor <[email protected]>

---------

Co-authored-by: Dominic Gannaway <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: domgan-oai <[email protected]>
leonidaz pushed a commit that referenced this pull request Aug 10, 2026
* docs(packaging): plan CommonJS package conditions

* feat(packaging): add CommonJS graph builder

* fix(packaging): parse CommonJS graphs with esbuild

* feat(octane): publish CommonJS runtime entries

* feat(bindings): publish CommonJS runtime graphs

* test(packaging): exercise packed CommonJS consumers

* chore(release): record CommonJS package conditions

* test(packaging): run CommonJS tarball canary

* test(packaging): compare ESM and CommonJS parity

* fix(review): guard CommonJS output deletion

* fix(review): reject lossy CommonJS transforms

* feat(packaging): compile TSRX CommonJS graphs

* perf(packaging): reuse TSRX compilation work

* feat(packages): support callable CommonJS defaults

* fix(packages): recognize TSRX CommonJS roots

* perf: speed up server-rendered HTML escaping (#629)

* perf: skip unchanged conditional keyed rows (#628)

* perf: skip unchanged conditional keyed rows

* fix: exclude Activity boundaries from keyed row memoization

* fix(ci): prevent usehooks hydration timeout

* fix(ci): refresh React parity evidence hashes

* perf: reuse bounded keyed-reorder scratch storage (#630)

* perf: add minimal-import bundle reachability budgets (#631)

* perf: add minimal-import bundle reachability budgets

* fix: register reachability benchmark with MCP server

* fix: preserve side-effect-only bootstrap entrypoints (#633)

* perf: cache stable renderable regions and prune sync warming (#634)

* perf: cache stable renderable regions and prune sync warming

* fix: preserve uppercase-prefixed custom hook state

* fix(benchmarks): remove js-framework DOM node metrics (#636)

* fix(bindings): classify production bundle side effects (#637)

* feat: enable React Compiler across framework benchmarks (#639)

* perf: reduce core runtime and compiled application bundles (#638)

* Version Packages (#601)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix(commonjs): fail closed on authored .tsrx modules

Refuse compiling .tsrx into CommonJS packaging output so published packages keep source for consumers to compile.

Co-authored-by: Cursor <[email protected]>

* fix(commonjs): restore published require export conditions

Re-apply the CommonJS require maps for octane and the binding packages after the main merge dropped them.

Co-authored-by: Cursor <[email protected]>

* fix(commonjs): order require before default and wire binding prepack

Put import/require ahead of default in octane publishConfig.exports so Node does not always pick the ESM graph, and run build:cjs from prepack for the binding packages that advertise dist/cjs.

Co-authored-by: Cursor <[email protected]>

* fix(compiler): discover source packages without a CommonJS build

require.resolve failed on prepack-only dist/cjs entries in CI, so Vite
source discovery skipped Base UI and nested bindings. Fall back to the
installed package manifest when the require target is missing.

Co-authored-by: Cursor <[email protected]>

---------

Co-authored-by: domgan-oai <[email protected]>
Co-authored-by: Dominic Gannaway <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Cursor <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-authored Diff or issue body substantially produced by an AI agent perf PR: performance work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant