Repository navigation
perf(octane): land a committed list's new component row by its root at commit - #2093
Conversation
…t commit A committed list's new direct-host row keeps its one root detached until commit, which inserts it alone. A row whose body is a sole component still rendered into a run fragment, which its commit moved and whose members it rehomed, so inserting such a row cost more than on main. The compiler now flags a sole-component row whose component's own template inserts the root (bit 7; a keyed selection's index moves to bits 8+), and mountItem keeps that row's root detached too. commitBag self-marks the component's Block and the row with the root, and leaves a lite stand-in, which has no range of its own, with no end. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issue. You can view the agent here.
Reviewed by Cursor Bugbot for commit 4453a95. Configure here.
Benchmark report
Compares js-framework: 1k/10k row operationsAll 20 timed operations (20 without a verdict)
All 64 work counters are unchanged. Application bundle size (bytes)
12 other measured values are unchanged. Public-import reachability bundles (bytes)
39 other measured values are unchanged. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
octane-website | 4453a95 | Commit Preview URL Branch Preview URL |
Oct 15 2026, 03:12 PM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
octane-website-mcp | 4453a95 | Commit Preview URL Branch Preview URL |
Oct 15 2026, 03:07 PM |

Summary
nextagainstmain.Why
DETACHED_ROOT). A sole-component row still rendered into a run fragment instead. Its commit moved that fragment's nodes and rehomed the members, including afor…inover each bag.next, uibenchtree/*/[insertFirst(1)]and[insertLast(1)]measured 1.07–1.35×main.Changes
compile.js). RecordshostRootfor a component whose own template inserts its single root, without the@if-arm widening ofsingleRoot. A sole-component@forrow over such a component now sets forBlock flag bit 7 (128). The keyed-selection dependency index moves from bits 6+ to bits 8+. Before this change it could also collide with the dev-only bit 6.runtime/lists.ts.forBlockpassesssrMarkerlessastrue(server direct host) or2(client-only sole-component row).mountItemkeeps the root of either kind of row detached. Hydration still adopts by root only fortrue.runtime/templates.ts(commitBag). When the root is detached,commitBagnow self-marks every Block up to the row that handed the row's end down: the component's Block, then the row. A lite stand-in, which has no range of its own, gets no end.@ifarms, or one with only an imported$$singleRootstamp, still renders through a run. Its nested slots would otherwise keep the detached anchor.Measurements
uibench:
octane-tsrxon this branch against amain(3691ea2) tree, on non-default ports (5415/6415), 10 iterations per run. Geometric mean of the head/base median ratio over 2 runs before and 6 runs after:next)[10,50]move between 0.88 and 1.25.[10,50]residual is about the same size as that shape's removes, 1.04–1.05× before and after. That looks like the per-update cost of staging the list, not row insertion.js-framework work counters (
pair.mjs --work-onlyagainstmain, ports 5586/6586): all 40 counters are at or below main, with 0 increases.Bytes against
origin/next:Validation
pnpm typecheckoctane-signals*, with the render-write guard and an empty allowlist: 1,704 files and 48,097 tests pass. vite-plugin and rspack-plugin: 301 tests pass.for.test.ts: hookless and hookful sole-component rows that an update inserts at the start, middle and end, then updates, moves and removes. Both fail without thecommitBagchange (insertBeforegets a null root).pnpm format:files:checkon the changed files.pnpm test/pnpm format:check: left to CI.split-runtime.mjs check: on the split tree it reports thatruntime.tsis already split and checks nothing, so no post-split check exists yet.perf-review:perf-review-scan --diffon this PR's diff: no candidates.mountItem(per inserted row),commitBag(per template mount; the new loop runs only for a detached root),forBlock(per list render; one extra flag expression).ssrMarkerlessparameter now carriestrue,falseor2. It is only compared, never stored.concise-code:singleRootrow. Rejected:@if-root rows and@if-arm components keep the detached anchor in their slot state, and their suspend and arm-swap tests fail.Risk / follow-ups
@ifarms, or from an imported component with only a$$singleRootstamp, still render through a run. Covering them would need branch slots that tolerate a detached anchor.[10,50]).Provenance
agent-authored)🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.Note
Medium Risk
Touches hot list reconciliation, commit-time DOM placement, and forBlock flag layout; behavior is narrowed to compiler-proven sole-component host roots, with tests but not all single-root shapes covered.
Overview
Committed keyed
@forlists now treat a sole-component row like a direct host row when that component’s template inserts its single root: the row root stays detached until commit instead of rendering through a run fragment.The compiler records
hostRooton components (tied tosingleRoot, without@if-arm widening), emitsdetachRooton matching@foritems, and packs it as forBlock flag bit 7; the keyed-selection dependency index shifts to bits 8+ so it no longer collides with the dev-only missing-key bit.lists.tspassesssrMarkerlessastrue(server direct host) or2(client-only sole component), keeps those rows on the detached-root path inmountItem, and limits hydration root adoption tossrMarkerless === true.commitBagwalks ancestor blocks that share the detached end marker so component and row blocks self-mark with the inserted root before commit.New
for.test.tscoverage exercises hookless and hookful inserted component rows (insert, reorder, remove).Reviewed by Cursor Bugbot for commit 4453a95. Bugbot is set up for automated code reviews on this repo. Configure here.