Repository navigation
perf(octane): skip undo entries for writes into rows the render creates, and clear lists without a call per row - #1831
Conversation
…es, and clear lists without a call per row Every scheduled render opens the root undo journal. Abandoning the render discards each Block it created whole (undoCreatedInRootRender), so an undo entry for a write into such a Block's own hosts is never replayed. - A module-level ROOT_DISCARD_STAMP holds the createdStamp of the Blocks the active root attempt discards, or -1 under hydration or once adopted DOM is retained. beginRootRender and endRootRender (via the frame), preserveRootCreatedDom and hydrateRoot's hydrating mark keep it current. journalBag now tests that one field instead of the transaction's shape. - setEventHandler and setClassName skip their undo entry for a host of such a Block in the root window. Runtime callers that may write a host the current scope does not own pass `foreign`: signal-driven class writes, spread handlers, de-opt class and handler removal. - The deferred owned-list clear checks its old rows through the native nextSibling getter instead of calling getNextSibling per row. js-framework, exact production calls (octane-tsrx): create 1k 29,087 -> 25,087, replace 36,100 -> 32,100, append 37,086 -> 33,086, create 10k 290,084 -> 250,084, clear 10,097 -> 97. No operation gains a call or a DOM mutation. Wall time: create 1k -5.6%, create 10k -4.5%, other operations within noise. The byte growth (+181 raw / +83 gzip on rows) is raised in a separate budget-only pull request. Refs #1801. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
octane-website-mcp | 1d7abe3 | Commit Preview URL Branch Preview URL |
Oct 06 2026, 09:13 PM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
octane-website | 1d7abe3 | Commit Preview URL Branch Preview URL |
Oct 06 2026, 09:11 PM |
Benchmark report
Compares js-framework: 1k/10k row operationsAll 20 timed operations (20 without a verdict)
Work counters (an increase fails this check):
54 other measured values are unchanged. Application bundle size (bytes)
7 other measured values are unchanged. Public-import reachability bundles (bytes)
36 other measured values are unchanged. |
With #1832's raises on main, these measure below their budgets, and the downward ratchet asks for: - hydrate-root brotli 38,805 -> 38,747 (CI's own figure) - component-owned-effects brotli 22,602 -> 22,600 - binding-usehooks-ts-esbuild brotli 27,494 -> 27,475 - bindings app gzip 115,705 -> 115,704 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
Budget-only raise for #1833, which deferred its raise until #1831 landed because both raise the same budgets. #1832 covered #1831 alone, so main 50e18cc fails test shard 1/4 at "Verify every bundle budget" (cli-spa-starter raw 101,793 over 100,464). #1833 keeps link records for keyed-list rollback (record forms plus the link notes in each relinking reconcile path). Its own measurement: +1,359 raw / +443 gzip on rows. Measured on main 50e18cc with `run-minimal.mjs --write-budgets` and `run.mjs --write-budgets octane-tsrx octane-jsx` (measured + 32 raw/gzip, + 256 brotli); 60 raises, no lowerings: - every client scenario and app: about +1,355 raw, +415 to +475 gzip - cli-spa-starter 100,464 -> 101,825 raw, 33,454 -> 33,883 gzip - root-static 163,723 -> 165,078 raw; rows framework 104,467 -> 105,826 raw - jsx framework 177,637 -> 178,994 raw - brotli rises where the measurement passed the old value (+256 headroom) Bisected per commit on cli-spa-starter: 4dcb699 100,347 raw, #1833 101,708, #1834 101,708, #1831 101,793. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Summary
Every scheduled render opens Octane's root undo journal, not only transitions, so ordinary updates pay for undo bookkeeping. This PR removes two pieces of that work that can never be replayed. It is changes 1 and 3 from the #1801 journal investigation (comment); change 2, the O(changes) keyed-list snapshot, follows separately.
undoCreatedInRootRender), so undo entries for writes into such a Block's own hosts are never replayed.journalBagalready skipped the bag snapshot for those Blocks. Event handlers (JOURNAL_PROP, two per row in js-framework) and class names (JOURNAL_ATTRplus agetAttributeread) now skip their entry too.nextSiblinggetter in that walk instead of callinggetNextSiblingonce per row. The fallback stays when a ViewTransition stage is active.Measurements
benchmarks/js-framework/pair.mjsagainst main4dcb699866. Calls are exact production function calls (jitless Chromium); wall time is the paired median ratio with its 95% interval, over 30 pairs.No DOM mutation counter changes. Clear's wall time is dominated by removing 10k DOM nodes, so its call reduction does not show up as time.
Bytes: +181 raw / +83 gzip on rows, about the same on todo and the kitchen sink; every scenario pays at least +81 raw for the stamp bookkeeping. The raises are in budget-only #1832, which needs to merge immediately before this one.
Changes (
packages/octane/src/runtime.ts)ROOT_DISCARD_STAMP: thecreatedStampof the Blocks the active root attempt discards whole, or −1.preserveRootCreatedDomretains adopted DOM.beginRootRendersets it, andendRootRenderrestores it from the render frame without a call.hydrateRoot's hydrating mark andpreserveRootCreatedDomreset it.journalBagnow tests this one field.setEventHandlerandsetClassNameskip their undo entry when the root window is at depth 1 andCURRENT_SCOPE's Block carries the stamp.foreignargument keeps the entry for runtime writers that may touch a host the current scope does not own: signal-driven class writes (writeDirectSignalAttribute), spread handlers (setSpread, which a signal can republish), de-opt class writes and de-opt handler removal. These behave exactly as on main.deferRootOwnedListClear: the commit walk reads the nativenextSiblinggetter directly.Validation
--project octane: 43 files, 691 tests pass. These are every test file whose name mentions rollback, journal, transition, suspend, hold, batch-clear or root-render.fresh-root-scope-holdandroot-render-inputs.for-batch-clear.foreignguards fails nothing. Those guards only keep main's journaling on paths the skip should not touch: they never drop an entry main recorded.pnpm typecheck:files packages/octane/src/runtime.ts,pnpm format:files:check, andpnpm synccleanpnpm testandpnpm typecheckrepo-wide (left to CI under the local test-load rule)Risk / follow-ups
Provenance
agent-authored)🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
Touches rollback/journal invariants for class, events, and list clearing; guards limit skips to compiled fresh-row writes, but incorrect stamp handling could drop undo entries that rollback still needs.
Overview
Reduces root render undo journal overhead by tracking which Blocks an abandoned root attempt discards wholesale (
ROOT_DISCARD_STAMP). Writes from compiled bindings into those fresh rows no longer snapshot bags, class names, or event handlers for undo—the same ideajournalBagalready used, now extended tosetClassName/setEventHandlerand simplified injournalBag. Hydration, adopted DOM, and signal/spread-driven writes still journal viaforeignor stamp−1.Speeds clearing large owned lists at commit: when confirming old rows still fill the parent, the walk uses the native
nextSiblinggetter instead ofgetNextSiblingper row (unless View Transition staging is active).Bundle size budgets shift slightly; changeset notes ~14% fewer calls and ~5% faster for mounting 1k keyed rows, and a ~99% call drop on clear benchmarks.
Reviewed by Cursor Bugbot for commit e8e7a7b. Bugbot is set up for automated code reviews on this repo. Configure here.