Skip to content

perf(octane): clear inert keyed rows at root commit - #976

Merged
domgan-oai merged 1 commit into
octanejs:mainfrom
openai-oss-forks:codex/perf-js-framework-clear
Sep 6, 2026
Merged

domgan-oai merged 1 commit into
octanejs:mainfrom
openai-oss-forks:codex/perf-js-framework-clear

Conversation

@domgan-oai

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

Copy link
Copy Markdown
Contributor

Summary

  • Defer clearing an owned keyed list of inert host rows until the root render is accepted, then remove its DOM in one operation. Keep connected rows and the old key map available for suspension rollback; rows with refs, effects, nested scopes, or foreign DOM retain the existing cleanup path.
  • Make the local js-framework harness time Octane's completed script-click commit and verify each DOM result. Add an opt-in 1,000-row clear diagnostic with five warmups, 15 samples, and optional 4× CPU throttle.

Why

krausest/js-framework-benchmark#2093 reports a 28.8% clear regression while upgrading Octane. The earlier release could clear an owned table body in one DOM operation; root render transactions subsequently made the ordinary clear retain and remove each row individually. The new path preserves rollback while restoring bulk removal for safe host-only lists.

Validation

  • pnpm --config.verify-deps-before-run=warn sync (no generated tracked changes).
  • Scoped pnpm --config.verify-deps-before-run=warn format:files:check, git diff --check, and tsrx-tsc --noEmit -p packages/octane/tsconfig.json.
  • 101 relevant tests in each of development and production compile modes, using the task source with cached TSRX tooling. The new rollback tests were seen failing under deliberately broken eager deletion and omitted deletion.
  • Same-machine production Chromium 1,000-row clear at 4× CPU, 15 samples and two target orders: old [email protected] source 10.8 / 10.3 ms, current unmodified source 12.6 / 12.3 ms, candidate 10.9 / 10.7 ms (medians). Strong mode produced byte-identical bundles for this fixture. This local click timer excludes paint and is not the upstream Chrome timeline.
  • Final eight-sample local js-framework run: 10,000-row clear 27.3 → 24.0 ms; other operations were near baseline, and the DOM insertion and production-call gates passed. All 14 keyed-reorder identity/scratch gates passed.
  • Current-head CI run 34065583868 passed with frozen-lockfile dependencies: pnpm format:check, pnpm typecheck, four sharded pnpm test lanes, website, browser, React parity, package validation, and example checks.

Risk / follow-ups

  • Local exact dependency installation is blocked by the configured Socket registry's “Recently published” quarantine for @tsrx/[email protected] and @tsrx/[email protected]. Source tests and browser builds used cached older TSRX tooling, so CI must validate the locked versions.
  • The upstream benchmark's exact Chrome timeline should be rerun once this Octane change is published. The optimization applies only to an owned parent with at least 16 inert, single-node rows; all other clear paths remain available.

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

High Risk
Touches core keyed-list reconciliation, root transaction journaling, and suspension rollback—incorrect deferral could leak DOM, skip cleanups, or break undo on failed renders.

Overview
Restores fast bulk clearing for owned keyed lists (≥16 inert, single-host rows with no effects, refs, or nested scopes) by deferring DOM removal until the root render commits, using one textContent = '' wipe when the parent is still wholly owned. Suspended renders keep rows connected and swap the key map via journalForOwnedListClear so rollback can restore the prior list; lists that need lifecycle teardown still use per-row parking and the existing batchClearItems paths.

The js-framework benchmark harness now calls Octane’s flushSync through window.__benchFlush, checks that each op’s DOM is committed inside the timed click, and adds an opt-in CLEAR_1K / CPU_THROTTLE diagnostic suite without changing the canonical 10k clear op.

Tests cover owned-parent clear with @empty, suspension rollback, refills, foreign DOM, large ref cleanups, and hydration clear/refill on adopted lists.

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

@domgan-oai
domgan-oai marked this pull request as ready for review September 6, 2026 22:59
@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent perf PR: performance work labels Sep 6, 2026
@domgan-oai
domgan-oai merged commit 45f9761 into octanejs:main Sep 6, 2026
47 of 50 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