Skip to content

perf(octane): record only the relinked rows when a keyed list may roll back - #1833

Merged
trueadm merged 2 commits into
mainfrom
perf/keyed-snapshot-changes
Oct 6, 2026
Merged

trueadm merged 2 commits into
mainfrom
perf/keyed-snapshot-changes

Conversation

@trueadm

@trueadm trueadm commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Change 2 of the #1801 journal work (changes 1 and 3 are #1831).

What it changes: every scheduled render opens the root undo journal. Before a keyed list changed its order, journalForSlot copied the whole row chain and the key Map's order. It did that even for a two-row swap or a single removal. Inserts, removals and small reorders now record only the rows they relink.

Measured on the js-framework rows app:

wall time vs main
swap two rows (.tsrx) −17.4% [−19.6, −15.9]
remove one row (.tsrx) −22.2% [−23.5, −21.1]
remove one row (.tsx) −6.6%
every other operation within noise

Production calls and DOM mutations are unchanged on every operation. A knockout that skipped the snapshot entirely measured −18% / −23%, so this takes back essentially all of it.

How

Why only links are needed. restoreForSlot already rebuilds every row's prevSibling and itemIndex from chain position. So rollback only needs to walk the old order forward.

Link record. Each ForSlotRecord keeps the old head, and the old nextSibling of each row whose nextSibling the reconcile rewrites. Rollback walks the old chain through those links (fullForSlotRecord), then restores exactly as before.

Shape Rows recorded
inserts only (append, prepend, middle insert) beforeMiddle
removals only beforeMiddle (the removed run keeps its own links)
small displacement (≤ K_DISP moved rows) each displaced row, the row it lands after, the new middle's last row, beforeMiddle
index-only writes in the prefix, suffix and survivor walks nothing yet, but the record exists, so a render that throws after them still restores

Full form. LIS moves, full replace, clear and fills keep today's full snapshot, as does any wholesale change later in the same window. A newer window's record converts an enclosing link record to the full form first.

Key Map order stays exact, because context refresh iterates it:

  • Swaps: they leave the Map untouched.
  • Inserts: they only append fresh keys, which the old chain excludes.
  • Removals: while the new ForSlot.inOrder says the Map iterates in chain order, rollback rebuilds the Map from the chain. Otherwise the removal first keeps the Map's prior order.
  • The flag: it starts true for an empty Map, stays true through in-order fills, appends and removals, and turns false on any reorder or middle insert.

Call parity. journalForSlot(state, link?) is still one call per site. Record creation is inline, and so are the link notes.

Development cross-check. In development builds a link record also takes the full form. On use, it throws catalogued error 343 if the two differ. So every existing rollback test checks the link path.

Validation

  • New keyed-rollback-links.test.ts: 11 cases, each holding a root render that applies each shape, rolling it back, and checking committed node identity and order, then the settled result. The shapes are append, prepend, middle insert, middle removal, removal at the ends, removal after a committed reorder, swap, swap after a swap, several link reconciles in one held render, and a link reconcile followed by an LIS reorder or a full replace.
    • With temporary logging, 9 rollbacks expanded link records that held 1–5 links, so the cross-check ran on real link data.
  • Break checks: each one fails the new tests.
    • drop the removal's beforeMiddle note: 2 failures
    • drop the insert note: 4 failures
    • drop the swap neighbours: 2 failures
    • ignore the Map order on removal: 1 failure
  • Wider suites: every rollback, keyed-list and @for suite, --project octane (dev cross-check active), passes: 59 files, 896 tests. The new file and two existing rollback suites also pass under --project octane-prod.
  • pnpm typecheck:files, pnpm format:files:check, pnpm error-codes:check, and pnpm sync clean
  • pnpm test / pnpm typecheck repo-wide (left to CI under the local test-load rule)

Risk / follow-ups

  • Bytes: +1,359 raw / +443 gzip on rows, mostly the two record forms and the link notes.
  • Record lifetime: a removal's link record references the removed row, so records live only as long as their journal log. They are kept in a per-log Map held in a WeakMap keyed by the log, and are dropped with it at commit. The draftboard example's retired-shape GC check caught an earlier version that kept the record on the ForSlot. That check fails on that commit and passes now.
  • Correctness of the link path: it relies on every in-place relink recording the rows whose nextSibling it rewrites. The development cross-check catches any path that misses one in any rollback test.

Provenance

  • An agent produced this diff (agent-authored)

🤖 Generated with Claude Code


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
Changes core keyed-list reconcile and transition-journal rollback invariants; correctness relies on recording every relinked nextSibling, with dev-only cross-checks mitigating misses.

Overview
Keyed list transition rollback no longer snapshots the entire row chain and key-map order on every small reconcile. Inserts, removals, and small displacements use a link record that stores the old head and prior nextSibling values only for rows that get relinked; rollback reconstructs the chain from those links. Wholesale changes (LIS reorder, full replace, clear) still take a full snapshot, and a link record is upgraded to full if a later change in the same journal window needs it.

ForSlot gains an inOrder flag so rollback can rebuild the key Map from the restored chain when map iteration still matches DOM order, or preserve prior map order after reorders/middle inserts.

Dev builds keep a parallel full snapshot on link records and throw error 343 if link-based restoration disagrees. New keyed-rollback-links tests cover held renders across append/prepend/insert/remove/swap and mixed sequences.

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

…l back

Every scheduled render opens the root undo journal. Before a keyed list
changed its order, `journalForSlot` copied the whole row chain and the key
Map's order, even for a two-row swap or one removal.

Rollback rebuilds every row's prevSibling and index from chain position, so
it only needs to walk the old order forward. Inserts, removals and the
small-displacement shortcut now take a link record: the old head, plus the
old nextSibling of each row whose nextSibling they rewrite. Rollback walks
the old chain through those links. Index writes in the prefix, suffix and
survivor walks take the same record, so a render that throws after them
still restores. Wholesale relinks (LIS moves, full replace, clear, fills)
and a later wholesale change in the same window take the full form; a newer
window's record converts an enclosing link record to the full form first.

Key Map order stays exact:
- A swap leaves the Map untouched.
- Inserts only append fresh keys, which the old chain excludes.
- A removal rebuilds the Map from the chain while `ForSlot.inOrder` says the
  Map iterates in chain order, and otherwise keeps the Map's prior order.

Development builds also take the full form and throw catalogued error 343
when the link record restores a different shape. Every rollback test
therefore checks the link path.

js-framework (pair.mjs, octane-tsrx): swap -17.4% [-19.6, -15.9], remove
-22.2% [-23.5, -21.1] wall time; production calls and DOM mutations
unchanged on every operation.

Refs #1801.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent perf PR: performance work labels Oct 6, 2026
@github-actions
github-actions Bot marked this pull request as draft October 6, 2026 21:26
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
octane-website 888e3af Commit Preview URL

Branch Preview URL
Oct 06 2026, 09:47 PM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
octane-website-mcp 888e3af Commit Preview URL

Branch Preview URL
Oct 06 2026, 09:49 PM

…fetime

The link record for a removal stores beforeMiddle's old nextSibling, which is
the removed row. Keeping the newest record on the ForSlot (`state.journal`)
held it after the render committed, so a removed row and its DOM stayed
reachable until the list's next journaled change. The draftboard example's
retired-shape GC check caught it.

Records now live in a per-log Map kept in a WeakMap keyed by the journal
log, so they go when a committed log is dropped. That also removes the
record's `log` field and the ForSlot field.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@trueadm
trueadm marked this pull request as ready for review October 6, 2026 21:39
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Benchmark report

  • ❌ bundle-size: 36 value(s) exceed their committed budget
  • ❌ bundle-reachability: 24 value(s) exceed their committed budget
  • 🔴 bundle-size: 9 value(s) increased within budget

Compares 4dcb69986, the merge commit's first parent with 03c3457f6 on the same runner. A byte value over its committed budget or any increase in a js-framework work counter fails this check. Wall time is a report: base and head samples alternate in one browser, and an operation is called slower or faster only when the 95% confidence interval of its ratio excludes ±3%. Workflow run

js-framework: 1k/10k row operations

target operation base ms head ms head/base 95% CI
octane-tsrx swap 0.087 0.068 −15.1% −37.1% … −11.7% 🟢 faster
All 20 timed operations (19 without a verdict)
target operation base ms head ms head/base 95% CI
octane-tsrx run 5.425 3.733 −3.4% −10.6% … ±0.0% ⚪ within noise
octane-tsrx replace 11.408 11.725 +5.5% +1.9% … +41.2% ⚪ within noise
octane-tsrx add 4.925 4.917 +4.6% −1.7% … +25.9% ⚪ within noise
octane-tsrx update 0.254 0.256 +0.2% −21.0% … +20.6% ⚪ within noise
octane-tsrx select 0.015 0.012 −1.2% −11.7% … +29.6% ⚪ within noise
octane-tsrx swap 0.087 0.068 −15.1% −37.1% … −11.7% 🟢 faster
octane-tsrx remove 0.032 0.031 −18.7% −22.6% … +4.0% ⚪ within noise
octane-tsrx runlots 44.308 45.383 +0.0% −4.5% … +6.0% ⚪ within noise
octane-tsrx select_lots 0.009 0.011 +6.7% −0.3% … +37.8% ⚪ within noise
octane-tsrx clear 82.367 60.842 −7.1% −28.8% … +11.0% ⚪ within noise
octane-jsx run 7.692 6.533 −1.7% −42.1% … +8.6% ⚪ within noise
octane-jsx replace 14.300 13.958 −0.3% −8.9% … +30.1% ⚪ within noise
octane-jsx add 7.192 4.900 −10.0% −41.7% … −2.5% ⚪ within noise
octane-jsx update 0.438 0.470 +1.2% −15.3% … +15.5% ⚪ within noise
octane-jsx select 0.216 0.185 −7.0% −17.6% … −0.6% ⚪ within noise
octane-jsx swap 0.358 0.337 +0.9% −5.5% … +13.3% ⚪ within noise
octane-jsx remove 0.246 0.246 −3.3% −6.2% … −0.3% ⚪ within noise
octane-jsx runlots 69.567 70.633 −2.0% −14.0% … +14.3% ⚪ within noise
octane-jsx select_lots 6.263 7.554 +8.2% −18.1% … +46.2% ⚪ within noise
octane-jsx clear 67.233 68.250 +3.9% −10.9% … +11.8% ⚪ within noise

All 64 work counters are unchanged.

Application bundle size (bytes)

❌ 36 value(s) exceed their committed budget. Reduce the growth, or raise the budget in a separate pull request that names the bytes and the reason (CONTRIBUTING.md, "Size budgets").

target metric head budget over
octane-tsrx fw_raw 105,613 104,286 +1,327
octane-tsrx fw_gzip 34,309 33,898 +411
octane-tsrx fw_brotli 30,425 30,290 +135
octane-tsrx js_raw 112,559 111,232 +1,327
octane-tsrx js_gzip 36,644 36,232 +412
octane-tsrx js_brotli 32,451 32,321 +130
octane-tsrx todo_fw_raw 116,339 115,017 +1,322
octane-tsrx todo_fw_gzip 37,230 36,820 +410
octane-tsrx todo_fw_brotli 32,804 32,683 +121
octane-tsrx todo_js_raw 120,957 119,635 +1,322
octane-tsrx todo_js_gzip 39,449 39,041 +408
octane-tsrx todo_js_brotli 34,686 34,564 +122
octane-tsrx chat_fw_raw 113,941 112,619 +1,322
octane-tsrx chat_fw_gzip 36,565 36,142 +423
octane-tsrx chat_fw_brotli 32,273 32,134 +139
octane-tsrx chat_js_raw 119,706 118,384 +1,322
octane-tsrx chat_js_gzip 39,279 38,856 +423
octane-tsrx chat_js_brotli 34,662 34,526 +136
octane-tsrx weather_fw_raw 134,107 132,761 +1,346
octane-tsrx weather_fw_gzip 42,784 42,381 +403
octane-tsrx weather_fw_brotli 37,530 37,320 +210
octane-tsrx weather_js_raw 156,261 154,915 +1,346
octane-tsrx weather_js_gzip 50,655 50,253 +402
octane-tsrx weather_js_brotli 44,179 43,973 +206
octane-tsrx bindings_fw_raw 338,285 336,960 +1,325
octane-tsrx bindings_fw_gzip 108,342 107,927 +415
octane-tsrx bindings_fw_brotli 94,146 93,902 +244
octane-tsrx bindings_js_raw 685,935 684,610 +1,325
octane-tsrx bindings_js_gzip 224,014 223,601 +413
octane-tsrx bindings_js_brotli 190,318 190,199 +119
octane-jsx fw_raw 178,775 177,450 +1,325
octane-jsx fw_gzip 56,356 55,983 +373
octane-jsx fw_brotli 49,084 49,031 +53
octane-jsx js_raw 187,040 185,715 +1,325
octane-jsx js_gzip 59,213 58,841 +372
octane-jsx js_brotli 51,492 51,435 +57
target metric base head Δ
octane-tsrx js_raw 111,200 112,559 +1,359 (+1.2%) 🔴
octane-tsrx js_gzip 36,200 36,644 +444 (+1.2%) 🔴
octane-tsrx js_brotli 32,065 32,451 +386 (+1.2%) 🔴
octane-tsrx app_gzip 2,334 2,335 +1 (+0.0%) 🔴
octane-tsrx app_brotli 2,031 2,026 −5 (−0.2%) 🟢
octane-tsrx fw_raw 104,254 105,613 +1,359 (+1.3%) 🔴
octane-tsrx fw_gzip 33,866 34,309 +443 (+1.3%) 🔴
octane-tsrx fw_brotli 30,034 30,425 +391 (+1.3%) 🔴
octane-tsrx todo_js_raw 119,603 120,957 +1,354 (+1.1%) 🔴
octane-tsrx todo_js_gzip 39,009 39,449 +440 (+1.1%) 🔴
octane-tsrx todo_js_brotli 34,344 34,686 +342 (+1.0%) 🔴
octane-tsrx todo_app_gzip 2,221 2,219 −2 (−0.1%) 🟢
octane-tsrx todo_app_brotli 1,884 1,882 −2 (−0.1%) 🟢
octane-tsrx todo_fw_raw 114,985 116,339 +1,354 (+1.2%) 🔴
octane-tsrx todo_fw_gzip 36,788 37,230 +442 (+1.2%) 🔴
octane-tsrx todo_fw_brotli 32,460 32,804 +344 (+1.1%) 🔴
octane-tsrx chat_js_raw 118,352 119,706 +1,354 (+1.1%) 🔴
octane-tsrx chat_js_gzip 38,824 39,279 +455 (+1.2%) 🔴
octane-tsrx chat_js_brotli 34,287 34,662 +375 (+1.1%) 🔴
octane-tsrx chat_app_brotli 2,384 2,389 +5 (+0.2%) 🔴
octane-tsrx chat_fw_raw 112,587 113,941 +1,354 (+1.2%) 🔴
octane-tsrx chat_fw_gzip 36,110 36,565 +455 (+1.3%) 🔴
octane-tsrx chat_fw_brotli 31,903 32,273 +370 (+1.2%) 🔴
octane-tsrx weather_js_raw 154,903 156,261 +1,358 (+0.9%) 🔴
octane-tsrx weather_js_gzip 50,224 50,655 +431 (+0.9%) 🔴
octane-tsrx weather_js_brotli 43,829 44,179 +350 (+0.8%) 🔴
octane-tsrx weather_app_gzip 7,872 7,871 −1 (−0.0%) 🟢
octane-tsrx weather_app_brotli 6,665 6,649 −16 (−0.2%) 🟢
octane-tsrx weather_fw_raw 132,749 134,107 +1,358 (+1.0%) 🔴
octane-tsrx weather_fw_gzip 42,352 42,784 +432 (+1.0%) 🔴
octane-tsrx weather_fw_brotli 37,164 37,530 +366 (+1.0%) 🔴
octane-tsrx bindings_js_raw 684,583 685,935 +1,352 (+0.2%) 🔴
octane-tsrx bindings_js_gzip 223,575 224,014 +439 (+0.2%) 🔴
octane-tsrx bindings_js_brotli 189,943 190,318 +375 (+0.2%) 🔴
octane-tsrx bindings_app_gzip 115,673 115,672 −1 (−0.0%) 🟢
octane-tsrx bindings_app_brotli 96,191 96,172 −19 (−0.0%) 🟢
octane-tsrx bindings_fw_raw 336,933 338,285 +1,352 (+0.4%) 🔴
octane-tsrx bindings_fw_gzip 107,902 108,342 +440 (+0.4%) 🔴
octane-tsrx bindings_fw_brotli 93,752 94,146 +394 (+0.4%) 🔴
octane-tsrx full_fw_raw 562,686 564,059 +1,373 (+0.2%) 🔴
octane-tsrx full_fw_gzip 169,110 169,586 +476 (+0.3%) 🔴
octane-tsrx full_fw_brotli 142,333 142,670 +337 (+0.2%) 🔴
octane-jsx js_raw 185,683 187,040 +1,357 (+0.7%) 🔴
octane-jsx js_gzip 58,809 59,213 +404 (+0.7%) 🔴
octane-jsx js_brotli 51,179 51,492 +313 (+0.6%) 🔴
octane-jsx app_gzip 2,858 2,857 −1 (−0.0%) 🟢
octane-jsx app_brotli 2,404 2,408 +4 (+0.2%) 🔴
octane-jsx fw_raw 177,418 178,775 +1,357 (+0.8%) 🔴
octane-jsx fw_gzip 55,951 56,356 +405 (+0.7%) 🔴
octane-jsx fw_brotli 48,775 49,084 +309 (+0.6%) 🔴
octane-jsx full_fw_raw 562,686 564,059 +1,373 (+0.2%) 🔴
octane-jsx full_fw_gzip 169,110 169,586 +476 (+0.3%) 🔴
octane-jsx full_fw_brotli 142,333 142,670 +337 (+0.2%) 🔴

7 other measured values are unchanged.

Public-import reachability bundles (bytes)

❌ 24 value(s) exceed their committed budget. Reduce the growth, or raise the budget in a separate pull request that names the bytes and the reason (CONTRIBUTING.md, "Size budgets").

target metric head budget over
cli-spa-starter raw 101,708 100,379 +1,329
cli-spa-starter gzip 33,816 33,406 +410
cli-spa-starter brotli 29,681 29,607 +74
root-static raw 164,859 163,536 +1,323
root-static gzip 51,991 51,607 +384
root-static brotli 45,242 45,145 +97
binding-base-ui-vite raw 196,858 195,535 +1,323
binding-base-ui-vite gzip 61,830 61,444 +386
binding-base-ui-vite brotli 53,700 53,512 +188
binding-base-ui-esbuild raw 212,350 211,005 +1,345
binding-base-ui-esbuild gzip 68,751 68,303 +448
binding-base-ui-esbuild brotli 59,739 59,451 +288
binding-radix-vite raw 198,888 197,565 +1,323
binding-radix-vite gzip 62,409 62,029 +380
binding-radix-vite brotli 54,202 54,110 +92
binding-radix-esbuild raw 214,175 212,830 +1,345
binding-radix-esbuild gzip 69,332 68,875 +457
binding-radix-esbuild brotli 60,184 59,957 +227
binding-apollo-client-vite raw 339,302 337,970 +1,332
binding-apollo-client-vite gzip 104,126 103,709 +417
binding-apollo-client-vite brotli 90,858 90,704 +154
binding-apollo-client-esbuild raw 362,488 361,137 +1,351
binding-apollo-client-esbuild gzip 115,095 114,695 +400
binding-apollo-client-esbuild brotli 100,480 100,190 +290
target metric base head Δ
cli-spa-starter raw 100,347 101,708 +1,361 (+1.4%) 🔴
cli-spa-starter gzip 33,374 33,816 +442 (+1.3%) 🔴
cli-spa-starter brotli 29,386 29,681 +295 (+1.0%) 🔴
root-static raw 163,504 164,859 +1,355 (+0.8%) 🔴
root-static gzip 51,575 51,991 +416 (+0.8%) 🔴
root-static brotli 44,889 45,242 +353 (+0.8%) 🔴
binding-base-ui-vite raw 195,503 196,858 +1,355 (+0.7%) 🔴
binding-base-ui-vite gzip 61,412 61,830 +418 (+0.7%) 🔴
binding-base-ui-vite brotli 53,366 53,700 +334 (+0.6%) 🔴
binding-base-ui-esbuild raw 210,973 212,350 +1,377 (+0.7%) 🔴
binding-base-ui-esbuild gzip 68,271 68,751 +480 (+0.7%) 🔴
binding-base-ui-esbuild brotli 59,342 59,739 +397 (+0.7%) 🔴
binding-radix-vite raw 197,533 198,888 +1,355 (+0.7%) 🔴
binding-radix-vite gzip 61,997 62,409 +412 (+0.7%) 🔴
binding-radix-vite brotli 53,918 54,202 +284 (+0.5%) 🔴
binding-radix-esbuild raw 212,798 214,175 +1,377 (+0.6%) 🔴
binding-radix-esbuild gzip 68,843 69,332 +489 (+0.7%) 🔴
binding-radix-esbuild brotli 59,848 60,184 +336 (+0.6%) 🔴
binding-apollo-client-vite raw 337,938 339,302 +1,364 (+0.4%) 🔴
binding-apollo-client-vite gzip 103,677 104,126 +449 (+0.4%) 🔴
binding-apollo-client-vite brotli 90,448 90,858 +410 (+0.5%) 🔴
binding-apollo-client-esbuild raw 361,105 362,488 +1,383 (+0.4%) 🔴
binding-apollo-client-esbuild gzip 114,663 115,095 +432 (+0.4%) 🔴
binding-apollo-client-esbuild brotli 99,976 100,480 +504 (+0.5%) 🔴

81 other measured values are unchanged.

@trueadm
trueadm merged commit e595a13 into main Oct 6, 2026
45 of 52 checks passed
@trueadm
trueadm deleted the perf/keyed-snapshot-changes branch October 6, 2026 22:02
trueadm added a commit that referenced this pull request Oct 6, 2026
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]>
trueadm added a commit that referenced this pull request Oct 8, 2026
… a row (#1890)

* perf(octane): copy a keyed reorder's record directly until it relinks a row

A keyed reorder records its list at the first row index it rewrites, before it
knows whether it will relink a few rows or every row. Since #1833 that record
allocated its `links` Map and a per-journal records Map up front. When the
reorder then reached the LIS path, `fullForSlotRecord` walked the chain through
the empty links Map and, for a key Map already out of chain order, built a Set
of every row to filter it.

The record now gets its links Map at its first relink (`forSlotLinks`). Until
then only index writes have run, which change neither the chain nor the key
Map, so converting it copies the list as it stands, which is the full form's
cost before #1833. The record rides in the spare slot of its own undo entry,
found again through the window's `seen` index, so `SLOT_RECORDS` is gone and the
record still lives exactly as long as its log.

- recursive-context zero-context reorder: 4 Map constructions -> 2, so
  context-cache-work.mjs passes its ceiling again (bisected to e595a13).
- js-framework reorder matrix (octane-tsrx, paired, 12 samples): rotatef,
  rotateb and displace3-8 are 22-27% faster than main and within 5% of the
  runtime before #1833; removals and inserts keep #1833's gains.
- Framework bundles are 129-137 raw bytes smaller; budgets lowered.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* perf(octane): look a keyed list's record up only when its window has an entry

The PR bench counted two more production calls on every js-framework
operation: journalForSlot and journalForOwnedListClear called the record
lookup, and fullForSlotRecord with no record, even for a list's first record in
a render, where there is no entry to find. Skip both when the list has no
entry. Every js-framework calls_* and dom_* counter now equals main's
(pair.mjs --work-only).

Lower the bindings app and total brotli budgets the ratchet now asks for.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* perf(octane): read a keyed list's record from its undo entry inline

Inline the record lookup in journalForSlot and journalForOwnedListClear. With
the helper, the bindings app's framework chunk compressed 21 gzip bytes larger
than main's, past its budget, although raw was 104 bytes smaller. Inline, it is
5 gzip bytes larger and 10 under the budget. Production calls are unchanged:
every js-framework calls_* and dom_* counter equals main's (pair.mjs
--work-only against c0192ec).

Re-measure the bundle budgets on current main. The merges took main's budget
files, and this writes 40 lowers and no raises.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci(bench): lower the budgets by this change's measured saving over #1891

The merge took main's budget files. #1891 raised 70 rows ahead of #1875,
which is still open. Each raw and gzip row now drops by exactly what this change
saves against main (2f81266), measured per scenario on both trees. A row
#1891 raised therefore keeps #1875's headroom. Brotli rows keep main's values,
and no value is raised.

Every head measurement fits its budget. The ratchet flags only the 70 rows
#1891 raised for #1875, as it does for any PR until #1875 lands.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci(bench): re-lower the budgets this change saves on after #1875 landed

The merge took main's budget files. Each raw and gzip row that main
(abe9b42) fits drops by exactly what this change saves against main,
measured per scenario on both trees. Brotli rows keep main's values unless the
ratchet asks for less. That gives 24 lowers and no raises.

Main measures over 35 rows after #1875 and #1888, and #1887 budgets that
growth. Those rows keep main's values here. Merging #1887 will re-lower the
ones this change also saves on.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci(bench): re-lower the budgets this change saves on over #1893

The merge took main's budget files (6eef1e0). Each raw and gzip row that
main fits drops by exactly what this change saves against main, measured per
scenario on both trees. Brotli rows keep main's values unless the ratchet asks
for less. That gives 37 lowers and no raises. The rows #1893 raised for #1892
keep #1892's growth. The 30 rows main exceeds until #1887 lands keep main's
values.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci(bench): re-lower the budgets this change saves on over 87d9f95

The merge took main's budget files. Main now fits every row. Each raw and gzip
row drops by exactly what this change saves against main, measured per scenario
on both trees. Brotli rows keep main's values unless the ratchet asks for less.
That gives 63 lowers and no raises. The rows #1893 raised for #1892 keep
#1892's growth.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci(bench): lower the budgets by this change's saving over main's ratchet

The merge took main's budget files. e14fbdf set every budget to main's
measured bytes plus headroom. Each raw and gzip row drops by exactly what this
change saves against main, measured per scenario on both trees. Brotli rows
keep main's values unless the ratchet asks for less. That gives 56 lowers and
no raises. Every ceiling and the ratchet hold locally, and so do the
budget-raise and hydration-free checks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci(bench): lower the budgets by this change's saving after #1892

The merge took main's budget files (68aa481), which match main's measured
bytes. Each raw and gzip row drops by exactly what this change saves against
main, measured per scenario on both trees. Brotli rows keep main's values
unless the ratchet asks for less. That gives 54 lowers and no raises.

Locally, binding-mantine-hooks-esbuild brotli is 7 bytes over main's value,
27,265 against 27,258. Its raw and gzip bytes equal main's: esbuild assigns
different minified names in that bundle, and brotli compresses them
differently.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: domgan-oai <[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