Skip to content

Runtime: one renderer — run descriptors through the compiled-template instructions (drop the ~15 kB gzip generic renderer) #2030

Closed as not planned

Description

@trueadm

Summary

Octane ships two renderers. Compiled templates run on Block/slot instructions with compiler-specialized setters. Alongside them sits a generic descriptor renderer, about 50 kB raw / 15 kB gzip in the shell_ app from #2027. It has its own child dispatcher, list reconcilers, host reconciler, component path and generic prop tables. Every real app ships both, and this second renderer is the whole reason Octane's core is larger than React's.

Measured on the shell_ app (oxc minify; sourcemap attribution per declaration; gzip figures are the marginal saving from deleting each group's bytes and re-gzipping). The React reference here is react-dom 19.2.8:

Area Octane React 19.2.8
Render/reconcile: blocks, component slot, templates, control flow, keyed lists, generic children vs beginWork, child reconciler, completeWork, commit 71.1k / 21.7k 46.3k / 12.6k
DOM props / attrs / style 14.1k / 4.7k 16.8k / 5.1k
Events 12.5k / 4.3k 20.6k / 6.9k
Controlled inputs + focus/selection 16.1k / 4.7k 6.5k / 2.2k
Hooks, effects, refs (React also counts the react package) 15.8k / 4.9k 21.9k / 6.5k
Core total (raw / gzip) ~145k / ~45k ~113k / ~33.5k

All of the ~11 kB gzip excess is in render/reconcile. Without the generic renderer the compiled-template core is about 30 kB gzip, below React's.

The second renderer

Generic descriptor renderer, shell_ app raw / gzip
childSlot dispatcher (+ renderReturnedValue, childTextHole, clearChildContent) 17.8k / 5.0k
Block-backed deopt lists/items (renderPreparedChildList, deoptItemBody, updateDeoptComponent, mappedDeoptItemBody) 11.2k / 3.3k
Raw-DOM host reconciler (reconcileDeoptNode/reconcileDeoptChildren, applyDeoptProps/patchDeoptProps, removeHostProp) 6.3k / 2.2k
Block-backed host (hostElementBody, hostStringTagBody) 2.3k / 0.7k
Generic setAttribute + ATTRIBUTE_ALIASES / SVG_ONLY_TAGS / style tables 8.7k / 2.8k
Descriptor API (createScopedElement etc.) 3.8k / 1.0k
Total ~50k / ~15k

It duplicates the compiled path three times over:

  • Three list reconcilers: reconcileKeyed (LIS, used by @for and deopt arrays), reconcileDeoptChildren (a raw-DOM keyed diff), and mountItemsLinear/mountPassthroughListItem.
  • Two element/prop paths: compiled templates use clone plus compiler-specialized setters (compiled-only bundles have no setAttribute or alias tables). Descriptors use applyDeoptProps/patchDeoptProps/removeHostProp plus generic setAttribute.
  • Two component paths: componentSlotImpl vs updateDeoptComponent/deoptItemBody.

The lite/void/strong component tiers are not a size problem (0.5–1.8k raw each).

Every real app reaches it

  • .tsx: a return <jsx> body is value position and is lowered to createElement descriptors by design (the compile.js SSR comment explains that the server matches this so block counts agree). Only hookless single-root components get templates.
  • .tsrx: any renderable hole, {children}, a component not proven to return a compiled template, lazy, dynamic tags and ViewTransition all reach childSlot. The edges are componentSlot → renderReturnedValue → childSlot, componentSlot → hostStringTagBody → childSlot and ViewTransition → initializeViewTransitionComponent → childSlot.
App (framework gzip) .tsx .tsrx
base, {String(count)} 58.0k 29.5k
base, bare {count} — 56.9k
rich (@for, @if, controlled input, dynamic attributes) 58.1k 39.6k
rich + one {props.children} — 59.4k (+19.8k)
full shell_ app 124.3k 122.7k

The render(<App/>) entry is not the cause: it costs +53 B gzip over render(App).

Target design

  • Descriptors are input to the same Block/slot instructions as templates. One generic host-element instruction serves descriptors and dynamic tags, so there is no separate raw-DOM host reconciler.
  • reconcileKeyed is the only list reconciler. Descriptor arrays, @for and passthrough lists all use it.
  • One prop path. The compiled setters plus one generic setProp for spreads and descriptors. The alias and SVG tables stay only on the generic path.
  • One component path. componentSlotImpl; updateDeoptComponent/deoptItemBody go away.
  • childSlot becomes a thin dispatcher: text, array, component, null.
  • .tsx return <jsx> compiles to templates. When the returned JSX is the component's output (not stored or passed around as a value), emit the same template code .tsrx gets. Server and client must change together, because the hydration cursor depends on matching block counts.

Estimated −7 to −10 kB gzip in the shell_ app, keeping about 5 of the 15 kB, which puts the core at or below React's. Separately, .tsx apps whose components can be compiled to templates also stop paying for descriptors in their own output.

Plan

Each step lands with its own measurement and the differential, conformance and hydration suites green:

  1. Measure. Add a .tsrx twin of the shell_ app and a .tsx "rich" app to the bundle-size report (reported only, no budget).
  2. One list reconciler. Descriptor arrays use reconcileKeyed; delete reconcileDeoptChildren's keyed diff. Benchmark large component-free descriptor trees, since this is the raw-DOM path's reason to exist.
  3. One prop path. Descriptor host props go through the compiled setters plus one setProp.
  4. One component path. Fold updateDeoptComponent/deoptItemBody into componentSlotImpl.
  5. Thin childSlot. Move portal, signal, thenable, context and off-screen branches behind drivers that their creators install.
  6. Compile .tsx return <jsx> to templates, keeping the server and the hydration cursor in step.

Must keep

  • React element semantics: createElement/cloneElement/Children/isValidElement, keys, element identity, descriptors as first-class values.
  • Keyed reconciler guarantees: final DOM and survivor identity (LIS-based; the set of moved nodes is not guaranteed).
  • Hydration of descriptor ranges, coordinated with Hydration: collapse the hydration engine back into the mount path (Ripple/Svelte-style cursor), 23 kB → ~5 kB gzip #2028's single marker protocol.
  • HMR and dev diagnostics.
  • Performance: js-framework rows, TodoMVC and the update benches must not regress. Large component-free descriptor trees are the case to watch.

Open questions

  • Does the raw-DOM deopt reconciler's speed on large component-free trees justify keeping a specialized path, or does reconcileKeyed with one generic host instruction match it?
  • Should the compiler warn or document when .tsx JSX stays on the descriptor path, so authors can see the cost?

Related: #2027 (benchmark), #2028 (hydration), #2029 (commit model), #1801 (size umbrella).

🤖 Generated with Claude Code

Activity

  1. added
    perf
    refactor
    agent-authored
    on Oct 13, 2026
  2. trueadm commented on Oct 13, 2026

    @trueadm
    CollaboratorAuthor

    Superseded by #2043, which covers the one-renderer work as part of a single compiled commit model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-authoredperfrefactor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions