weft
ir 2.6.0 · warp 1.8.0

Where a render runs, and what it may cost

Render is a DAG rather than a tree walk, executors are crash domains, and a budget is only a limit where something can be preempted.

wave 1feedheaderitemsnav
wave 2pricesrelatedtotal
wave 3footersummary
sequential123.3 ms
waves42.7 ms
9 slots, three waves: a 42.7 ms critical path against a 123.3 ms sequential walk. Safe for one reason — render is provably read-only, so two fragments cannot observe each other’s side effects.
✓ Valid A budget on a preemptible executor

pool: is a real worker_threads pool, so a breach terminates the render mid-loop and the slot falls to its declared behaviour.

✕ Refused a CPU budget on inline
what you wrote→inline cannot be preempted→reported, not enforced

The breach is reported with a message saying the render ran to completion anyway — rather than pretending it was stopped.

In plain terms

Slots that do not depend on each other run at the same time. Saying a slot needs another puts it in a later wave. Where a slot runs is separate: in the request, deferred, in a worker pool, or on another deployment entirely.

Three mechanisms that look unrelated and are not. Where a render runs, what it may spend, and when it is allowed to paint are all consequences of one property: a render cannot write, so nothing in it depends on anything else having finished.

A render is a DAG, not a tree walk

Every server renderer in production walks depth-first from root to leaf on one thread, and the conflation at the heart of that is treating existence dependency as data dependency. A child usually cannot start because its parent decides whether it exists — not because it needs the parent’s result.

In a plan, needs is data dependency and nothing else. Everything without it is dispatched immediately, so a page of six independent regions is six concurrent renders rather than one walk that visits them in file order.

sketch — not compiled
slots: {
  nav:   { fragment: 'nav' },                       // wave 1
  feed:  { fragment: 'feed', load: items },         // wave 1 — no needs, so no waiting
  recs:  { fragment: 'recs', needs: ['feed'] },     // wave 2 — it reads what feed loaded
}

An executor is a crash domain

Where a fragment runs is a plan decision, not something the fragment knows. The default is inline: the same thread, no boundary, no serialisation. pool: is a worker pool, and the reason to choose one is rarely speed — it is that a fragment which can take down a process should not be able to take down this process.

ExecutorWhere it runsWhat a failure costs
inlineThis thread.The request. A crash is the whole render.
pool:<name>A worker in that pool.One region. The page degrades to its placeholder.
binding: / svc:Another deployment.One region, and the boundary is a network hop — see composition.

A budget is a limit only where something can be preempted

A slot may declare a CPU ceiling and what happens when it is passed. On a worker pool that is real: the work is spent in one place, measured, and stopped. On inline it is advisory and the framework says so, because several renders and the stream interleave on one thread — a number measured around one of them is a number that measured all of them.

What a region sends when it is out of budget is declared beside the budget, and it is the cheapest template there is:

No holes at all: this template is constant, so rendering it is a buffer copy. A fallback that had to query something could fail the way the region it stands in for did.

output

This part of the page is not here yet. The rest of it is unaffected.

app/fragments/examples/placeholder.tsx
import { fragment } from '@weftjs/core'

/**
 * The bytes a region sends when it degrades: honest, cheap, and visibly incomplete.
 *
 * It has no holes at all, so it is constant — one sealed template whose version never changes and
 * whose render is a buffer copy. That is what makes it usable as a placeholder in a budget: a
 * fallback that had to query something could fail the same way the region it stands in for did.
 */
export default fragment(() => (
  <div class="degraded" data-degraded>
    <p>This part of the page is not here yet. The rest of it is unaffected.</p>
  </div>
))
What the compiler knows
Holes0
Escape elided0
Effect setnone — static
Wire formshtml · bundle · split · patch · delta

Holes

No holes: every byte of this template is constant.

What the client wires on adoption

No wiring: nothing on this template changes after it is painted, so the client attaches nothing to it.

Sealed templates
1
Version
9102e55e49cd988e420ba7d201d8451b

Declared as a slot’s placeholder. The page is still a page, and the part that is missing says so.

sketch — not compiled
slots: {
  recs: {
    fragment: 'recs',
    executor: 'pool:heavy',
    budget: { cpuMs: 40, exceed: 'placeholder' },
    placeholder: { fragment: 'placeholder' },
  },
}

And when it may paint

The third consequence: because a render is read-only, the client can hold a fully resolved region and not show it. That is what an epoch is, and it is what instant navigation is built out of.