Skip to content

perf: reuse child-only warm plans - #1020

Merged
domgan-oai merged 1 commit into
octanejs:mainfrom
openai-oss-forks:codex/warm-child-plan-981
Sep 9, 2026
Merged

domgan-oai merged 1 commit into
octanejs:mainfrom
openai-oss-forks:codex/warm-child-plan-981

Conversation

@domgan-oai

@domgan-oai domgan-oai commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Compiled components with independent same-module children register a warm plan on every render. The old path allocates an empty batch array, a child-plan closure, and a registration object even when the tree renders synchronously.

Reuse the existing attached child-only plan with the current props, and store registrations as flat block/plan/props triples. A descendant's first pending read still starts independent sibling requests, including on later updates.

  • Retain lexical plans for own async creations, reassigned props, mutable or shadowed component bindings, and plans that have not been attached yet. Keep SSR and universal-renderer emission on the established path.
  • Cover saved hoisted components whose bindings change through typed eval or destructuring, and preserve render-stack cleanup on success, suspension, and rollback.
  • Add a patch changeset, production work gates, and documentation. Partial progress on Track V8 performance audit findings across runtime, SSR, universal core, and compiler output #981; complex warm-plan allocations and memo ancestor walks remain open.

Performance evidence

Same-machine production Chromium call counts against base 266302ef9:

TSRX operation Empty useBatch registrations before Empty useBatch registrations after Hoisted plan registrations after
Mount / full update 2048 0 2048
Partial update / remount 62 0 62

Root/partial text writes remain exactly 1024/32; the TSX control uses neither registration helper. The own-promise control retains four batch calls, starts each parent/child resource once, and renders the expected values. Reassignment, local-shadow, context-cache, DOM, and survivor-identity controls pass. Timing is diagnostic only; this PR claims removal of the measured registration work and associated explicit allocations, not a wall-clock speedup.

Validation

  • Current-head CI run: all 26 jobs passed. Attempts 1 and 2 hit upstream React input-otp selection and SWR polling controls; their isolated local suites passed (19 and 362 tests), and attempt 3 passed without code changes.
  • Scoped pnpm format:files:check, source pnpm typecheck:files, git diff --check, and pnpm sync.
  • Parallel-use tests: 118 passed across development and production. New saved-binding regressions were observed failing before the guard fix; disabling the new helper also made the eight-request regression fail.
  • Focused compiler suites: 867 tests, plus final AST/parser/memo checks: 101 tests.
  • Final production recursive-context work gate and TSRX/TSX semantic benchmark.
  • Retried HTTP/browser checks with local access: 36 tests passed.
  • Full repository pnpm typecheck.
  • Full Octane development/production test projects: 989 files, 17,514 tests passed (14 expected failures).
  • pnpm test — broad sandboxed run interrupted after HTTP/browser access failures and unrelated package failures; the targeted HTTP/browser retry above passed. Repository CI will provide the complete suite result.
  • Repo-wide pnpm format:check — scoped formatting used instead.

Risk / follow-ups

The optimization is deliberately limited to plans proven to contain only child traversal with stable captures. The legacy fallback still allocates its array/closure, and the warm-memo ancestor traversal in #981 is separate work. Registration remains active before any suspension has occurred so first-request parallel discovery is preserved.

Provenance

  • An agent produced this diff (agent-authored)

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Note

Cursor Bugbot is generating a summary for commit 18296d0. 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 Sep 9, 2026
@domgan-oai
domgan-oai marked this pull request as ready for review September 9, 2026 17:33
@domgan-oai
domgan-oai merged commit 9b17f4e into octanejs:main Sep 9, 2026
96 of 104 checks passed
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