Repository navigation
perf(octane): drop element-descriptor dispatch from holes and lists without a factory - #2258
Conversation
A renderable hole now handles a non-primitive kind only when something in the bundle can create it. Descriptor factories install ELEMENT_DESCRIPTORS, and every factory of a list item other than text (descriptors, compiled children and maps, createPortal) installs the keyed list (CHILD_LISTS). Without one, an array or iterable child renders as a text list: one Text per leaf, keyed by index path, adopting the server's per-item ranges when hydrating. The compiler routes a portal that a module-local component returns to createPortalChild, which supports only lone portal children. Hole-free bundles also drop descNeedsBlocks, deoptChildNamespace, childrenIterator and isHostDescriptor. 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 | 66472f0 | Commit Preview URL Branch Preview URL |
Oct 28 2026, 09:43 AM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
octane-website | 66472f0 | Commit Preview URL Branch Preview URL |
Oct 28 2026, 09:44 AM |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Host path leaves text-list nodes
- Added
state.texts !== nullto the pure-host path guard on line 1130, so clearChildContent is called when transitioning from a text list to a host element, matching the analogous guard in the text/empty path.
- Added
Or push these changes by commenting:
@cursor push 0741e305ac
Preview (0741e305ac)
diff --git a/packages/octane/src/runtime/child-slots.ts b/packages/octane/src/runtime/child-slots.ts
--- a/packages/octane/src/runtime/child-slots.ts
+++ b/packages/octane/src/runtime/child-slots.ts
@@ -1127,7 +1127,8 @@
// Pure host/text → reconcile in place, REUSING the existing node so DOM
// state survives a re-render. Switching in from a component/text first
// tears that down (also nulls a stale hostNode).
- if (state.block !== null || state.text !== null) clearChildContent(state);
+ if (state.block !== null || state.text !== null || state.texts !== null)
+ clearChildContent(state);
if (state.end === null) {
// ANCHORLESS: no markers — the element self-delimits, so reconcile
// straight against the tracked node. A same-tag value patches it inYou can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit e41ff79. 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)
11 other measured values are unchanged. Public-import reachability bundles (bytes)
39 other measured values are unchanged. |
…tors only A function inside an array child renders as a body, which descriptor-list-hydrate pins (#710), so every bundle with an array hole needs the keyed list's per-item Blocks. Drop the text-only list, the CHILD_LISTS installer and the createPortalChild compiler proof. Keep the descriptor gates (ELEMENT_DESCRIPTORS, HOST_DESCRIPTORS) and the hole-free residue fixes. The reachability check now asserts that a Strong app keeps no descriptor-only declarations and no descriptor-guarded branch of child-slots.ts or deopt.ts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ilities # Conflicts: # packages/octane/src/runtime/child-slots.ts # packages/octane/src/runtime/deopt.ts # packages/octane/src/runtime/elements.ts # packages/octane/src/runtime/hydration.ts
Main's new HOST_DESCRIPTORS guards (#2258) now read HOST_BODY, the binding this branch sets exactly when the host renderer is installed. Co-Authored-By: Claude Opus 5.5 <[email protected]>


Summary
Renderable holes and the keyed child list now dispatch element descriptors only in a bundle that can build one. A Strong-mode or pure
.tsrxapp whose holes hold text (typed props reach the compiler as plain{props.message.author}holes) ships no component-descriptor, Fragment, keyed-element or host-descriptor code.ELEMENT_DESCRIPTORS(runtime/drivers.ts): every descriptor factory sets it (createElementFromConfig, the scoped element and value records, and through themcreateElement,createHostElementanddeferRecord).childSlot, the keyed list (flatten, keyed-single preparation, positional children,deoptItemBody,mappedDeoptItemBody,reconcileDeoptNode,descNeedsBlocks,updateDeoptComponent) and hydration's claim checks read it before any descriptor test, so oxc folds those branches away without a factory.HOST_DESCRIPTORS(perf(octane): ship the host descriptor renderer only where host descriptors exist #2247's driver) now also gateschildSlot's upgrade handoff, anchorless promotion and pending item pairs,lists.ts's self-marking of host items, and the compiled-map host takeover.descNeedsBlocksanddeoptChildNamespacewere kept only by their own recursion and become named function expressions.lists.ts's descriptor self-marking is gated.enableOpaqueTemplates, which the compiler emits only for modules with such a template.normalizeClassstill ships forclass={cond ? 'a' : ''}. The compiler routes every HTMLclassbinding tosetClassName, which composes inline (typeof value === 'string' ? value : normalizeClass(value)). Dropping it needs a string-only class writer selected fromisKnownStringExpression, registered with the presentation-hydration writers. Proposed as a separate task.Why the keyed list stays in every bundle with array holes
Arrays of primitives must keep rendering.
Behavior kept for a bare function in an array (
{[Comp]}): it renders as a body, the same in every bundle. React renders nothing there and warns in development.docs/differences-from-react.mddoesn't document that case, butdescriptor-list-hydrate.test.tspins render-as-body through its "render function from an array forwarding wrapper" cases (#710). So this PR keeps render-as-body and puts it in the minimal tier rather than behind an installer.array-text-children.test.tschecks it on the server and the client: before any element factory runs, while one first runs under a live list, and after.Rendering a function item needs a Block at its position, with teardown, transactions and hydration adoption, which is the keyed list. A text-only list could therefore never be the whole minimal tier.
An earlier revision of this PR added such a list behind a
CHILD_LISTSinstaller, plus acreatePortalChildcompiler proof for returned portals. Both are dropped. As a side effect, descriptor apps no longer carry the text list as dead code (about 0.8 KB gzip).In relay, 6.5 KB raw of
deopt.tsstays reachable from any array-valued hole:renderPreparedChildList1,781,deoptItemBody1,386,mappedDeoptItemBody118 (named unconditionally asmapSlot's fallback body),teardownChildForSlot93.appendScopedDeoptKey,flattenReactChildContainer,nestedDeoptKeyPrefix,prepareDeoptListand smaller helpers, about 1.3 KB.reconcileDeoptNodeplus the deferred text-order helpers, about 0.66 KB.promoteSelfMarkedItem,landItemPairanditemRange, about 0.66 KB. Only host-descriptor and compiled map rows self-mark, so this could be gated oncemapSlotinstalls its fallback item body. That is a follow-up candidate.descNeedsBlocks240,iterableChildArray185.A portal-only list path would not remove the list, because pinned function items need it too.
Validation
Bytes. Production
vite build(oxc minify), all client JS, base d44d6d9 → head:Apps that build descriptors pay about 200 raw bytes for the flag checks and installers.
Performance.
js-framework
pair.mjs --work-onlyon this head: all 40 calls/DOM counters are identical to base.octane-jsx
selectandselect_lotswere checked locally because the CI report flaggedselectat +13.3% on the previous head. The harness ran this head's and base's production builds, plus a null control: a second page on the base build. The three pages alternated each sample, withpair.mjs's calibration and selection checks, 80 samples per side, in two rounds. The +13.3% did not reproduce:selectselectselect_lotsselect_lotsBase medians were 0.110–0.111 ms per
select. The CI work counters for both ops match base: calls went from 8,111 to 8,110 and from 80,111 to 80,110.Earlier revision (every change kept here, plus the text list and installer), timed with
pair.mjs(30 pairs, run twice): no op's interval lay beyond ±3% in either run.dbmon (tsrx, jsx and the createElement deopt fixture; whole-suite rounds plus a per-sample alternating harness): within that harness's measured null floor, where head against itself reads 1.014 [1.009, 1.019].
chat-stream: DOM census identical, timings within noise. The descriptor-stream sidecar was within noise, as were the descriptor-renderer children and forms work counts.
props.mjsandevents.mjsfail identically on base and head.This head, per-sample dbmon: deopt tick 0.983 [0.965, 1.036], tick_partial 1.005 [1.005, 1.010], sort 1.027 [0.948, 1.079]; jsx tick 0.995, tick_partial 1.000.
Checks:
pnpm format:files:checkon the changed files (repo-widepnpm format:checkleft to CI)tsc -p packages/octane/tsconfig.jsonandpnpm typecheck:fileson the changed files. Only the existing_server-fixture.ts/TS4111 baseline remains; repo-widepnpm typecheckleft to CI.pnpm test: left to CI, per the local test-load rulearray-text-children.test.ts(new): the array-of-text contract, plus function items rendering as bodies on the server and client. It runs before an element factory runs, while a factory first runs under a live list, and after.optional-driver-bundle.test.ts(new "renderable holes" section): a Strong app with holes, text arrays, compiled children and a returned portal keeps no descriptor-only declaration and no descriptor-guarded branch ofchild-slots.tsordeopt.ts. A descriptor app is the control that proves the oracle sees each one.octaneandoctane-prod. 198 related runtime and hydration files (4,121 tests) pass.perf-review:node scripts/perf-review-scan.mjs→ no candidates. The hot paths touched add one boolean load each, with no new field, allocation or call:childSlot, per non-primitive hole render.deoptItemBodyand list flattening, per item.concise-code: src +102 −34 (runtime +98 −34).ELEMENT_DESCRIPTORS/enableElementDescriptorsandenableOpaqueTemplates, each with a caller.Risk / follow-ups
deopt.tsdeclarations" in the Strong fixture. The keyed list lives indeopt.tsand is needed by every array hole, so the check asserts no descriptor-only declarations or branches instead. Splitting the list into its own module would make that structural; it is a byte-neutral follow-up.Provenance
agent-authored)🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.Note
Medium Risk
Touches core child reconciliation and hydration claim paths behind boolean guards; behavior must stay identical once a factory runs, and wrong folding would break descriptor or host-heavy apps.
Overview
Renderable holes and keyed child lists now treat JSX-style element descriptors as a lazy capability. Apps that never call an element factory (typical Strong-mode / pure
.tsrxwith text-only holes) no longer ship descriptor classification, Fragment/keyed-element paths, host-descriptor upgrades, or related hydration branches—minifiers can fold guarded code away.ELEMENT_DESCRIPTORSis flipped on only when a factory runs (createElementFromConfig, scoped element records, etc.).childSlot,deopt.tslist prep/reconcile, and hydration read this flag (and existingHOST_DESCRIPTORS) beforeisElementDescriptor/ host-only logic.enableOpaqueTemplatesis compiler-emitted for namespace-3 templates sodeoptChildNamespacestays out of bundles without opaque templates;descNeedsBlocks/deoptChildNamespacebecome named function expressions so descriptor-free bundles can drop them when nothing references them.Tests:
array-text-children.test.tslocks array-of-text behavior with and without a factory;optional-driver-bundle.test.tsasserts production bundles with text holes retain no descriptor-only source ranges.Reviewed by Cursor Bugbot for commit 66472f0. Bugbot is set up for automated code reviews on this repo. Configure here.