Skip to content

perf: reuse universal owner draft collections - #1009

Merged
domgan-oai merged 2 commits into
octanejs:mainfrom
openai-oss-forks:codex/reuse-universal-owner-draft-collections-981
Sep 9, 2026
Merged

domgan-oai merged 2 commits into
octanejs:mainfrom
openai-oss-forks:codex/reuse-universal-owner-draft-collections-981

Conversation

@domgan-oai

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

Copy link
Copy Markdown
Contributor

Summary

  • Reuse the seenEffects, children, and claimedChildren collections already allocated with a fresh universal owner draft on its first executeOwner pass. Render-phase retries still discard children and effects from the abandoned pass.
  • Add a public object-driver regression for keyed child identity, effects, events, state, and cleanup across a render-phase retry.
  • Add a production owner-heavy benchmark with zero/one-owner controls and output/identity checks. Addresses the per-owner draft collection finding in Track V8 performance audit findings across runtime, SSR, universal core, and compiler output #981.

Validation

  • pnpm format:check (scoped formatting check used)
  • pnpm typecheck (scoped typecheck used)
  • pnpm test (focused universal suite used)
  • pnpm format:files:check packages/octane/src/universal-core.ts packages/octane/tests/universal-state-updates.test.ts benchmarks/bench.mjs benchmarks/README.md benchmarks/universal-owner-drafts/run.mjs benchmarks/universal-owner-drafts/README.md .changeset/reuse-universal-owner-draft-collections.md
  • pnpm typecheck:files packages/octane/src/universal-core.ts packages/octane/tests/universal-state-updates.test.ts
  • ./node_modules/.bin/vitest run packages/octane/tests/universal*.test.ts --reporter=dot — 36 dev/prod files, 714 tests passed.
  • ./node_modules/.bin/vitest run packages/octane-mcp-server/src/index.test.js --reporter=dot — 15 tests passed, including benchmark suite and MCP schema synchronization.
  • node benchmarks/bench.mjs --quick universal-owner-drafts — semantic controls passed.
  • Deliberately omitted the retry effect reset: the new test failed in both modes with an abandoned effect; restored the reset and both passed.
  • pnpm sync — no additional generated changes.

Performance evidence

Node 26.4.0 on macOS arm64; production bundles from merged main and this branch, 13 samples × 20 accepted updates per process, sequential baseline–candidate–candidate–baseline. Scores in ms/update: 128 owners 0.1363 / 0.1187 / 0.1237 / 0.1256; 1,024 owners 1.3296 / 1.1435 / 1.1499 / 1.1921. Zero- and one-owner controls were effectively flat. Every run had matching output hashes, retained host identities, all changed-prop child renders, and zero structural commands. Process variation is material, so these measurements support a modest improvement in this synthetic owner-heavy workload rather than an application-wide claim.

Risk / follow-ups

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

Medium Risk
Touches universal render/retry semantics in executeOwner; mitigated by a detailed retry test for effects, identity, and events, though browser/native paths are not separately exercised.

Overview
Reuses per-owner draft scratch collections on the first executeOwner pass instead of clearing children/seenEffects and allocating a fresh claimedChildren set every time. Render-phase retries (renderCount > 0) still call resetDraftChildren and reset seenEffects so abandoned passes are not published.

Adds a Node-only universal-owner-drafts benchmark (0/1/128/1,024 keyed child owners with forced prop churn, identity and zero-structural-command gates) and wires it into bench.mjs. Adds a regression test for keyed lists across a render-phase retry: stable survivor identity, correct effect cleanup/mount, and no events on torn-down hosts.

Patch-level octane changeset; targets owner-draft allocation overhead from #981.

Reviewed by Cursor Bugbot for commit 5cfe97b. 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 Sep 9, 2026
@domgan-oai
domgan-oai marked this pull request as ready for review September 9, 2026 08:12
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