Skip to content

Runtime vision: render computes, commit writes — one compiled commit model #2043

Closed

Description

@trueadm

Vision

Octane should stay small when an app uses everything: hydration, lazy routes, Suspense, transitions, ViewTransition and signals together. Each feature should cost about what React's equivalent costs, and urgent updates should keep Octane's direct-write speed.

The way there is one principle: render computes, commit writes. Render never mutates live DOM. It works out what changed and memoizes it on the block. A commit step generated by the compiler applies those changes:

  • immediately, for urgent work;
  • later, for work that has to wait (transitions, Suspense reveals, ViewTransition);
  • never, for work that gets thrown away.

One commit model replaces the many separate ways Octane hides, defers and undoes DOM writes today.

Why

With every feature in use (the shell_ app from #2027), Octane ships about 122 kB gzip of framework code where React 19.3 plus alien-signals ships about 70 kB. React gets the gap back in implementation size, not tree-shaking:

Area Octane React 19.3 / alien-signals
Transitions, Suspense/try/lazy, root journal, off-screen rendering, ViewTransition staging, signal transitions 39 kB 15.5 kB
Hydration 23 kB ~5 kB
Signals ~22 kB 1.4 kB
Core render, props, events, hooks ~45 kB ~33.5 kB

Rows overlap, so they don't sum to the total.

Most of it has one cause. Because render writes to the live DOM, every feature that must keep a render invisible has had to build its own way of undoing or hiding those writes. There are nine today:

  • a root undo journal
  • deferred teardown
  • keyed-row parking
  • boundary reveal windows
  • off-screen capture
  • held transitions with replay and rebase
  • hide/reveal/resume
  • a DOM proxy (DOMStage) with staged commits for ViewTransition
  • a separate transition coordinator for signals

Hydration adds its own undo log and several Suspense paths. React needs one commit phase for all of it.

Principles

  1. Render never mutates live DOM. The only DOM a render touches directly is a fresh subtree that isn't attached yet.
  2. The compiler owns the write. Every binding's DOM write lives in a commit function the compiler generates once per template, outside the component, so nothing is allocated per render.
  3. Committed state is what the DOM shows. Bail-outs, comparisons and event dispatch all read committed values. Pending work sits beside committed state and is promoted at commit or dropped for free. There is no undo, and no snapshot taken just in case.
  4. One mechanism for every reason to wait. Transitions, Suspense, off-screen swaps, ViewTransition, hydration recovery and signal transitions all mean "this work isn't committed yet," and they share one commit step.
  5. Pay only for what you use. Queues, pending slots and transition code exist only where a transition, boundary or feature actually needs them.
  6. React semantics where Octane promises them, including React's commit timing.

Design

Commit functions

The binding bag on each block already holds every node and memoized value at slots the compiler assigns. Render compares new values against the committed ones. For each template, the compiler hoists a commit function that takes only the block and writes the changed slots by index:

function C(b) { const n = b.next; if (n[0] !== b.a) { setClassName(b.b, n[0]); b.a = n[0]; } … }
  • Urgent render: runs C straight away. This is today's eager write path, made explicit.
  • Render that may be held or dropped: writes into a next slot array, allocated the first time such a render touches the block, and queues the block. Commit runs the queued commit functions in render order, before refs and effects.
  • Drop: discards next. Hold: keeps it.
  • Event handlers: C installs the committed handler, and dispatch reads that.

Structure

Every control-flow, list and child slot keeps an applied and a next structure. Commit swaps branches or runs the keyed (LIS) reconcile between them, and runs deletion cleanups while the old nodes are still connected, as React does.

Content that falls back to a Suspense fallback is hidden in place with display:none, with its effects disconnected and reconnected, as in React. It is never detached.

Update queues

  • Hook state: state and reducer cells get React-style update queues, each update tagged with its batch. A queue is created only on a cell's first transition update, so urgent-only cells keep a direct write.
  • Holding a transition means leaving its updates unprocessed. Nothing is reverted, re-rendered or promoted.
  • Entanglement: batches that update the same cell are committed together.
  • Optimistic updates: useOptimistic is an update tagged to be reverted when its batch commits.

Signals

  • Fork semantics: signal writes inside a transition stay invisible to committed UI and DOM bindings until the transition commits.
  • Representation: one pending slot per producer, with batches that touch the same producer entangled, as hook cells are. There is no per-batch copy of each signal.
  • DOM bindings read committed values and re-run when the transition lands.
  • Core: the reactive graph stays lean. Writable and synchronous derived signals carry no async state.

Hydration (#2028)

  • Markers follow source structure only, never which client path renders a node. Every hole is exactly one range, and a boundary's state is carried in its opening marker.
  • Hydration is a small cursor that asserts ranges instead of probing for them.
  • A mismatch throws to the nearest boundary, which renders on the client and reports a recoverable error.
  • A hydrating render never runs commit functions. It records the adopted values as committed.
  • Opt-in modules: signal seeds, use() seeds and <Hydrate> ship only in apps that use them.

One renderer where it pays

Descriptors (createElement and .tsx children) run through the same commit model and prop writers as compiled templates. Features like portals, signals and Context are installed by the code that creates them. A specialised raw-DOM path remains only where it clearly earns its place, such as large component-free descriptor lists, and it uses the same keyed LIS moves.

Semantics we commit to

  • Server render errors follow React. @catch and ErrorBoundary don't run on the server. An errored boundary ships its fallback marked for client rendering, and no error details are serialized.
  • Signal writes inside startTransition keep fork semantics.
  • DOM writes from render become visible at commit, as in React. Custom-element callbacks, MutationObserver records and the focus moves they cause run during commit.

Must keep

  • React parity for transitions, Suspense, ViewTransition, hydration recovery, useId, actions and controlled inputs.
  • Urgent-update performance at today's direct-write speed.
  • Keyed-reconciler guarantees: final DOM and survivor identity.
  • Hydration's adoption of server nodes and preservation of input made before hydration.
  • <Hydrate when>.
  • Signal seeds for apps that use signals.

Not adopting from Solid 2.0

Solid 2.0's split of each render effect into compute and apply, diffing against the last applied value, informs the committed/next design. These parts conflict with React semantics, so we won't adopt them:

  • treating every write as a transition
  • boundaries that never show their fallback again
  • per-data isPending/latest
  • choosing, on every read, which version of a value the reader sees
  • hydration without mismatch checks

Roadmap

  1. Commit functions with committed and next values for compiled templates.
  2. Structural applied/next per slot, replacing the journal, deferred teardown, row parking, off-screen capture and reveal windows.
  3. ViewTransition applies queued commits inside startViewTransition, replacing DOMStage and staged commits.
  4. Update queues for hooks, then signals, replacing held transitions and the signals coordinator.
  5. Hydration on the cursor and the shared commit model (Hydration: collapse the hydration engine back into the mount path (Ripple/Svelte-style cursor), 23 kB → ~5 kB gzip #2028).
  6. Descriptor paths on the same commit functions.

Supersedes #2029, #2030, #2031. Hydration: #2028. Refs #2027, #1801.

🤖 Generated with Claude Code

Activity

  1. added
    perf
    refactor
    agent-authored
    on Oct 13, 2026
  2. changed the title [-]Runtime redesign: compiled commit functions, update queues and one commit model to close the size gap with React[/-] [+]Runtime vision: render computes, commit writes — one compiled commit model[/+] on Oct 13, 2026
  3. 117 remaining items

  4. added a commit that references this issue on Oct 28, 2026
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