<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Pyreon blog</title>
    <link>https://pyreon.dev</link>
    <description>How Pyreon works and what it can do: components that run once, one codebase for the web and, experimentally, iOS and Android, and benchmarks you can run yourself.</description>
    <language>en</language>
    <atom:link href="https://pyreon.dev/blog/rss.xml" rel="self" type="application/rss+xml" />
    <lastBuildDate>Mon, 23 Nov 2026 00:00:00 GMT</lastBuildDate>
    <item>
      <title>We caught our own benchmarks lying. Here’s every bug, and the wins that survived</title>
      <link>https://pyreon.dev/blog/we-keep-retracting-our-benchmark-wins</link>
      <guid isPermaLink="true">https://pyreon.dev/blog/we-keep-retracting-our-benchmark-wins</guid>
      <pubDate>Mon, 23 Nov 2026 00:00:00 GMT</pubDate>
      <category>javascript</category>
      <category>performance</category>
      <category>benchmarking</category>
      <category>webdev</category>
      <description>Eight measurement bugs in our own benchmark, from a String() call that switched off a rival’s compiler to statistics that counted 5 page loads as 100 samples. What each one cost, the guard that stops it now, and the results still standing.</description>
      <content:encoded><![CDATA[<p>Most benchmark pages show you the wins. Ours opens with the mistakes.</p>
<p>Section 0 of <a href="https://github.com/pyreon/pyreon/blob/main/BENCHMARKS.md"><code>BENCHMARKS.md</code></a> lists every verdict that moved and every claim we withdrew, above the results, not in a footnote. We hunted bugs in our own harness for months, and most of them made Pyreon look <em>better</em> than it was. We fixed every one, re-ran everything and published what came out.</p>
<p>Here is what survived:</p>
<ul>
<li><strong>130 µs</strong> to clear rows, an outright win in both runs against ten frameworks (Vue 3.6 Vapor RC: 145 µs)</li>
<li><strong>2.6×</strong> faster than React 19 building 10,000 rows</li>
<li><strong>3.8×</strong> faster than Preact building 10,000 rows</li>
</ul>
<p><a href="https://pyreon.dev/benchmarks">How we measure, and every result →</a></p>
<p>It also ties for the lightest retained heap on the board. Those numbers came through every bug below, and that is why they mean something.</p>
<p><em>Synthetic, author-run, Apple M3 Max, real Chromium. Reproduce: <a href="https://pyreon.dev/docs/benchmarks">pyreon.dev/docs/benchmarks</a>.</em></p>
<p>We publish where we lose, so you can trust where we win. Here are all eight measurement bugs we found in our own benchmark, what each one cost us, and the guard that stops it from coming back. Don't trust us. Run it.</p>
<h2>Start by distrusting us</h2>
<p>Pyreon's authors wrote every harness in the suite, wrote every competitor's implementation and decide what counts as a win. The record says so at the top: <em>author-judged, synthetic</em>. In a benchmark like that, every judgement call leans toward the home team, whether anyone means it to or not.</p>
<p>There are two answers to that. The first is an independent venue: a keyed Pyreon implementation for krausest/js-framework-benchmark is staged in the repo under <code>contrib/krausest/pyreon-keyed/</code>. Staged, not yet submitted. The second answer is this post: publish the method, publish every retraction, and make our work cheap to check.</p>
<h2>1. Competitors were running on their slow paths</h2>
<p>The first audit, in August 2026, found three handicaps in the row-list suite. All three favoured us (#2878):</p>
<ul>
<li><strong>Svelte</strong> ran on a deep <code>$state</code> proxy, and its arm also mapped 10,000 objects into a new array inside the timed region, for a type-level formality.</li>
<li><strong>Vue</strong> ran on a deep <code>ref</code>, which puts a Proxy on every row. Vue's own performance guide says not to do that for a list you replace wholesale.</li>
<li><strong>Octane</strong>, our closest rival, was pinned eight patch releases behind its latest version while every other dependency floated.</li>
</ul>
<p>We fixed them, re-ran, and republished every claim (#2864). The Svelte create-10,000 multiplier we had been quoting fell from about 2.5× to 1.19×. The PR says it plainly: "That was our benchmark's fault, not Svelte's."</p>
<p><strong>The guard:</strong> every arm runs on its framework's documented fast path. Vue uses compiled templates (hand-written <code>h()</code> disables patch flags), Solid arms match <code>babel-preset-solid</code>'s output, React and Preact go through the automatic <code>jsx()</code> runtime. When an arm is written at compiler-output level, we compile the snippet through the real toolchain and diff the emit. Our internal benchmark guide puts it in one line: "Do not reason about what the compiler probably does."</p>
<h2>2. We were timing clock ticks, not work</h2>
<p><code>clear rows</code> was published as "Octane 100 µs vs Pyreon 200 µs, 2.00× behind". On a page that is not cross-origin isolated, Chromium clamps <code>performance.now()</code> to 100 µs (a Spectre mitigation). Clear rows costs roughly 100 to 145 µs. So the suite was reporting which side of a tick each sample landed on. The real ratio at the time was 1.19–1.45× (#2894).</p>
<p>The tell had been in the output all along: a zero-width confidence interval next to a large coefficient of variation, <code>CI95 [200, 200] µs</code> with a CV of 0.38. A bootstrap over quantized samples reports perfect certainty because it cannot see the spread the clock threw away.</p>
<p><strong>The guard:</strong> the benchmark pages send COOP/COEP headers, which shrinks the clock quantum to 5 µs. The harness measures the quantum inside the served page and aborts if isolation or the quantum is not what the report claims. That check has already fired once, on a stale <code>vite preview</code> that was holding the port and serving un-isolated pages. For ops below about ten quanta, a batch instrument times many repetitions inside one window, the same idea krausest uses for its multi-iteration variants. A follow-up (#2987) caught the harness still gating ratios on a hard-coded 0.1 ms floor that contradicted its own measured quantum, and replaced it with the measured value.</p>
<h2>3. A <code>String()</code> call switched off a rival's compiler</h2>
<p>Octane's <code>select row</code> lost to Pyreon by about 110×. A margin that size usually means you are timing the other framework's slow path, so the audit started from the assumption that we had got it wrong (#2897).</p>
<p>We partly had. The Octane arm rendered <code>{String(row.id)}</code>; the React arm it was ported from passes <code>row.id</code> raw. Octane's compiler marks a <code>@for</code> body as dependency-pure only when it contains no render-time call, and <code>String()</code> is a render-time call. Compiling the arm with <code>octane/compiler</code> and reading the emit showed the <code>forBlock</code> flags drop from 30 to 26. That cleared the <code>depEligible</code> bit and sent every surviving row through the heavier <code>renderBlock</code> path:</p>
<pre><code class="language-js">// {String(row.id)}   flags=26  ->  renderBlock() per surviving row
// {row.id}           flags=30  ->  direct item-body call
_$forBlock(__s, 1, _b.a, _v, _key$0, __item$1, 30, [selectedId], null, _b.b, true)
</code></pre>
<p>It taxed four operations, not one. With the wrapper gone, Octane got faster on select, swap, partial update and replace, and the rendered DOM was byte-identical before and after.</p>
<p><strong>The guard:</strong> an arm does no presentation work that a real user of that framework would not write, and competitor arms are checked by compiling them, never by reading their source.</p>
<h2>4. A V8 cache was billed to the wrong framework</h2>
<p>The same week, the retained-heap column moved for five of eight implementations at once (#2899). Five arms (Pyreon, Solid, Vanilla, Vue, Octane) called <code>String(row.id)</code>. Three (React, Preact, Svelte) passed the number.</p>
<p>Converting many distinct integers to strings in JavaScript grows V8's <code>smi_string_cache</code>. That cache is held from the GC roots and never shrinks, and our heap metric reads <code>performance.memory.usedJSHeapSize</code>. So about 62 KB of engine cache was being charged to whichever arms stringified their ids. Assigning the number to <code>node.data</code> lets the DOM binding convert it outside JavaScript, for free.</p>
<p>The fix (every arm renders the raw <code>row.id</code>) changed four competitor arms and made Vanilla, the baseline Pyreon is judged against, lighter. One cell moved against us.</p>
<p><strong>The guard:</strong> the no-presentation-work rule, plus a heap-diff tool (<code>bench-heapdiff.ts</code>) that buckets heap snapshots by constructor and checks GC-root-held entries before anyone attributes a heap delta to a framework.</p>
<h2>5. A CSS default inflated our lead about 2.3×</h2>
<p><code>append 1,000 rows to 10,000</code> was bimodal for seven of eight frameworks: one cluster of samples near 18 ms, another near 50 ms, and the reported median depended on which cluster won a given run (#2903). Vanilla was hit hardest, which made hand-written DOM look 2.5× slower than the frameworks. That absurdity is what gave it away.</p>
<p>Splitting each sample into framework work and layout showed the framework part steady at 1.2–1.6 ms and the layout flush at either 17.5 ms or 50 ms. The cause was <code>table-layout: auto</code>, the CSS default. Column widths come from the widest cell in the whole table, so an op that introduces a wider cell forces Chromium to re-measure all 11,000 rows. Whether that happens depends on random label content and on what the table has already seen.</p>
<p>The same mechanism had inflated one of our headlines. We had published a <code>partial update</code> lead over Solid of about 4.9×. With layout held constant it was about 2.1×, so the CSS mode had inflated our lead roughly 2.3×. We withdrew the 4.9×. On today's record, partial update is a statistical tie with the fastest rivals.</p>
<p><strong>The guard:</strong> the fixture uses <code>table-layout: fixed</code> for every arm. That is less like a real app, on purpose: the cost it removes is identical work for every framework, triggered by random data. A bimodality guard (#2901) also refuses to publish a median that sits in an artifact mode. It computes <code>median / fastModeCentre</code>. In the measured data that ratio landed either at 1.00–1.03 or at 2.66–2.81, with nothing in between, so its 1.25 threshold is not a sensitive knob.</p>
<h2>6. A "tie" was a busy machine</h2>
<p>We had published hydration as a statistical tie with Vue. The run behind it was taken at a one-minute load average of 8.2. A re-run on a quiet machine (load 2.2–2.5, isolation verified, the served bundle hash checked against the file on disk) gave disjoint intervals in all four runs and a 3–4% Vue lead (#2920). The wide interval had been hiding a real gap, not proving there was none.</p>
<p>That PR also kept a tally of the August campaign: of its first six corrections, five had moved a Pyreon-friendly figure the wrong way for us.</p>
<p><strong>The guard:</strong> every suite runs strictly one at a time, waits for a one-minute load below 4, and stamps the load before and after. A close verdict is published only after two runs agree.</p>
<h2>7. A lead we had not earned</h2>
<p>In September, <code>clear rows</code> was recorded as Pyreon's only outright loss on the board, about 1.45× behind Octane, and the record called it architectural: "it will stay one". Then a re-measure showed Pyreon about 3.1× ahead (#3301).</p>
<p>We split the swing before banking it. About 1.5× was Pyreon getting faster, from three merged optimisations. About 3× was Octane getting slower on that op: version 0.2.2 had replaced its keyed-list block with a new path. And that Octane upgrade had arrived through our own dependency sweep (#3174), so we reported the bigger half as what it was: a change in a competitor, not a win for us.</p>
<p><strong>The guard:</strong> attribute a change to Pyreon only after splitting "Pyreon moved" from "competitor moved". And never call a gap architectural or permanent. Their code changes, and so does ours.</p>
<h2>8. One hundred samples that were really five</h2>
<p>This is the November one. The row board takes 20 samples per page load and 5 page loads per framework, and it bootstrapped those 100 samples as if each were independent. They are not. Samples from one page load share its JIT state and its heap, and page-to-page variation is large: per-page <code>swap rows</code> medians ranged from 620 to 860 µs for every arm, Vanilla included.</p>
<p>The fix (#4129) is a two-stage cluster bootstrap: resample page loads with replacement, then samples within each page. Re-deriving the 5 November verdicts with it moved three cells:</p>
<table>
<thead>
<tr>
<th>op</th>
<th>pooled interval said</th>
<th>cluster interval says</th>
</tr>
</thead>
<tbody>
<tr>
<td>swap rows</td>
<td>Pyreon 1.07× behind Vue Vapor RC in run 1</td>
<td>tie, both runs</td>
</tr>
<tr>
<td>create 10,000</td>
<td>Pyreon win, both runs</td>
<td>tie in run 1, 1.02× win in run 2</td>
</tr>
<tr>
<td>append 1k → 10k</td>
<td>Pyreon win, both runs</td>
<td>tie in run 1, 1.02× win in run 2</td>
</tr>
</tbody>
</table>
<p>A split is not a win, so we no longer claim the last two.</p>
<p>The same PR fixed a defect pointing the other way. The scenario harness ranked every arm against the leader, and when the leader was another Pyreon variant, that variant's wide interval turned a real loss into a printed tie. Our default chart input is 1.16–1.20× slower than Chart.js at 1,000,000 points. The harness had been hiding that loss. The record now states it.</p>
<p><strong>The guard:</strong> the board's intervals are cluster-bootstrapped, a run with fewer than three page loads prints "verdicts provisional", and each Pyreon arm is judged only against the best non-Pyreon arm. The scenario harness computes cluster intervals now too, but its published figures predate the fix, so the record marks its close scenario verdicts as provisional until the next run.</p>
<blockquote>
<p><strong>Every bug on this list became a pull request and a re-run. Don’t trust us. Run it.</strong></p>
</blockquote>
<h2>Count the directions</h2>
<p>Read the list again and notice which way the errors pointed. Handicapped competitors, a stringified id, a CSS default, a clamped clock, a busy machine, pooled intervals: almost every one made Pyreon look better than it was.</p>
<p>That is what author bias looks like in practice. Nobody wrote "make Octane slow". Someone wrote <code>String(row.id)</code> because it looked tidy, and nobody checked what Octane's compiler did with it.</p>
<p>So we audit a pleasant number with the same rigour as an unpleasant one. A 110× margin, "2.5× faster than hand-written DOM", a zero-width interval: we now treat each of those as a harness bug until proven otherwise.</p>
<blockquote>
<p><strong>Nobody wrote “make Octane slow”. Someone wrote String(row.id) because it looked tidy.</strong></p>
</blockquote>
<h2>What a verdict has to survive now</h2>
<ul>
<li><strong>A correctness gate runs before timing.</strong> Every implementation must produce the same observable DOM, read back from the table, on every iteration.</li>
<li><strong>One idiomatic Pyreon entry:</strong> the JSX you would ship. No hand-tuned "compiled" tier.</li>
<li><strong>Production builds, published competitor versions, seeded data,</strong> and a framework order reshuffled every pass.</li>
<li><strong>Cross-origin isolated pages</strong> with a measured 5 µs clock.</li>
<li><strong>Strictly sequential runs,</strong> gated on a load below 4.</li>
<li><strong>A win needs disjoint 95% intervals in both runs.</strong> Anything measured once says "one run".</li>
<li><strong>A tie has no ordinal.</strong> "Tied with Preact", never "second".</li>
<li><strong>Section 0 lists every verdict that moved</strong> and every claim withdrawn.</li>
</ul>
<h2>The board that survived all of it</h2>
<p>The row-list suite: 10 frameworks, real Chromium, two runs on 5 November 2026, Apple M3 Max. Pyreon against the fastest rival on each op:</p>
<table>
<thead>
<tr>
<th>op</th>
<th align="right">Pyreon (run 1)</th>
<th align="right">fastest rival (run 1)</th>
<th>verdict</th>
</tr>
</thead>
<tbody>
<tr>
<td>create 1,000 rows</td>
<td align="right">7.26 ms</td>
<td align="right">Vue 3 7.33 / Vapor RC 7.35</td>
<td>tie, both runs</td>
</tr>
<tr>
<td>replace all</td>
<td align="right">7.13 ms</td>
<td align="right">Vapor RC 7.11</td>
<td>tie, both runs</td>
</tr>
<tr>
<td>partial update</td>
<td align="right">705 µs</td>
<td align="right">Vapor RC 710</td>
<td>tie, both runs</td>
</tr>
<tr>
<td>swap rows</td>
<td align="right">805 µs</td>
<td align="right">Vapor RC 755</td>
<td>tie, both runs</td>
</tr>
<tr>
<td>remove row</td>
<td align="right">5.70 ms</td>
<td align="right">Octane 5.74</td>
<td>tie, both runs</td>
</tr>
<tr>
<td><strong>clear rows</strong></td>
<td align="right"><strong>130 µs</strong></td>
<td align="right">Vapor RC 145</td>
<td><strong>win, 1.11–1.12×, both runs</strong></td>
</tr>
<tr>
<td>create 10,000</td>
<td align="right">72.64 ms</td>
<td align="right">Vue 3 73.99</td>
<td>tie in run 1, 1.02× in run 2: not claimed</td>
</tr>
<tr>
<td>append 1k → 10k</td>
<td align="right">13.06 ms</td>
<td align="right">Octane 13.25</td>
<td>tie in run 1, 1.02× in run 2: not claimed</td>
</tr>
<tr>
<td>select row</td>
<td align="right">10 µs</td>
<td align="right">below clock resolution</td>
<td>batch instrument: 1.86–2.04× ahead of Octane (one run)</td>
</tr>
</tbody>
</table>
<p><em>Synthetic, author-run, Apple M3 Max, real Chromium. Reproduce: <a href="https://pyreon.dev/docs/benchmarks">pyreon.dev/docs/benchmarks</a>.</em></p>
<p>Clear rows is the one outright win on that board. On the rest, Pyreon, Vue 3.6 Vapor (a release candidate), Octane and on some ops Vue 3 are indistinguishable at this resolution, and we say so.</p>
<p>Step outside the leading pack and the gaps open up. Creating 10,000 rows takes Pyreon 72.6 ms against React 19's 192.0 ms (about 2.6×) and Preact's 278.0 ms (about 3.8×). Retained heap after the suite: Pyreon 3.08 MB and Preact 3.09 MB, tied as the lightest frameworks.</p>
<h2>Where we lose, from the same record</h2>
<p>These are not footnotes:</p>
<ul>
<li><strong>Deep component-tree mount:</strong> Solid is 1.15–1.18× faster (2,047 components, both runs).</li>
<li><strong>Bundle size</strong>, the same keyed-table app, gzipped: Pyreon 17.2 KB, Solid 7.5 KB, Preact 10.1 KB, Svelte 16.1 KB (Vue 27.4, React 69.6).</li>
<li><strong>Signal creation:</strong> about 5× slower than Preact Signals, on V8 and on JavaScriptCore.</li>
<li><strong>Hydrating a 1,000-row keyed table:</strong> tied with Vue on the framework walk; on the total, tied in one run and Vue 1.01× ahead in the other.</li>
<li><strong>Router matching at 10 routes:</strong> Hono is 1.91× faster (one run).</li>
<li>Smaller ones: effect-list dispose (Solid, by one clock quantum), swap at 100 and 1,000 rows on the batch instrument (Octane 1.12× and 1.10×, one run, and the result moves with batch size), chart line mounts at 10,000 and 1,000,000 points with row-object input, and store setup against Zustand.</li>
</ul>
<p><em>Synthetic, author-run, Apple M3 Max. Reproduce: <a href="https://pyreon.dev/docs/benchmarks">pyreon.dev/docs/benchmarks</a>.</em></p>
<p>One more correction is already queued. A harness fix merged after the record (#4142) makes Hono's router arm build its params object inside the timed call, as every other arm already did, and stops the store bench building Pyreon's store id inside the timed loop. Both figures above come from the run before it. The benchmark record is the source of truth; if it differs from this post, the record wins.</p>
<h2>What is still open</h2>
<ul>
<li><strong>No independent run exists yet.</strong> The krausest implementation is staged, not submitted. Until someone outside the project runs these, every number here is ours.</li>
<li><strong>The scenario suite's published intervals are still pooled.</strong> Its close verdicts (context propagation, effect-list update and dispose, table mount, the 10k chart mounts) stay provisional until the re-run.</li>
<li><strong>Three harness defects are open.</strong> The batch instrument's swap result fails its own check that per-op cost must not depend on batch size. Two summaries (router average, <code>rx</code>) print no interval, so they yield no verdict. And the TodoMVC <code>add-100</code> ratio has read 1.14×, 1.38–1.51× and 1.99× on different days for reasons we have not found, so we quote the range.</li>
<li><strong>Not measured at all:</strong> Firefox, Safari, streaming SSR, startup metrics, and anything resembling your application. These are synthetic workloads. A full-stack suite (<code>@pyreon/zero</code> against eight meta-frameworks) now exists in the repo, and no result from it is published yet.</li>
<li><strong>There will be more retractions.</strong></li>
</ul>
<p>Find a harness bug and it gets the same treatment as every entry above: a PR, a re-run, and a line in section 0. The main board is one command:</p>
<pre><code class="language-sh">cd examples/benchmark &#x26;&#x26; bun bench-fair.ts --repeat 5 --wait-quiet 4
</code></pre>
<h2>Check our work, then build something</h2>
<p>The full record, with every withdrawn claim, both runs, the competitor versions and every reproduce command, is at <a href="https://pyreon.dev/docs/benchmarks">pyreon.dev/docs/benchmarks</a>. Run it. Tell us what you find.</p>
<p>Then see what the surviving numbers feel like in an app of your own:</p>
<pre><code class="language-bash">npm create @pyreon/zero@latest
</code></pre>
<ul>
<li>Docs: <a href="https://pyreon.dev/docs">pyreon.dev/docs</a>. Why a component runs once: <a href="https://pyreon.dev/blog/components-run-once">the first post in this series</a>.</li>
<li>Star the repo: <a href="https://github.com/pyreon/pyreon">github.com/pyreon/pyreon</a></li>
<li>Questions, ideas, a bug: open an issue on <a href="https://github.com/pyreon/pyreon/issues">GitHub</a>, where every answer stays findable for the next person.</li>
</ul>]]></content:encoded>
    </item>
    <item>
      <title>Your component runs once. Here’s what replaced the re-render</title>
      <link>https://pyreon.dev/blog/components-run-once</link>
      <guid isPermaLink="true">https://pyreon.dev/blog/components-run-once</guid>
      <pubDate>Mon, 16 Nov 2026 00:00:00 GMT</pubDate>
      <category>javascript</category>
      <category>webdev</category>
      <category>typescript</category>
      <category>frontend</category>
      <description>Delete useMemo, useCallback and every dependency array. A Pyreon component runs one time, and a signal change updates the one text node that shows it. Here is the real compiler output that makes it work.</description>
      <content:encoded><![CDATA[<p>You know the afternoon. A list stutters, the profiler lights up, and you spend three hours learning that a callback got a new identity on every render. The fix is one <code>useCallback</code>. The lesson is that you now have to think about renders forever.</p>
<p>Pyreon removes the question. A component function runs <strong>once</strong>, when it mounts. When data changes, the one text node that shows it updates, and nothing else in the tree is visited. Nothing re-runs, so there is nothing to memoise: no <code>useMemo</code>, no <code>useCallback</code>, no dependency arrays.</p>
<p>Skipping all that work shows up on the clock. Pyreon builds 10,000 table rows <strong>2.6× faster than React 19</strong> (72.6 ms vs 192.0 ms). You don't take our word for any of it: the compiler output below shows exactly what runs.</p>
<p><em>Synthetic, author-run, Apple M3 Max, real Chromium. Reproduce: <a href="https://pyreon.dev/docs/benchmarks">pyreon.dev/docs/benchmarks</a>.</em></p>
<blockquote>
<p><strong>The best re-render is the one that never happens.</strong></p>
</blockquote>
<h2>Ten lines in, one binding out</h2>
<p>Here is a counter:</p>
<pre><code class="language-tsx">import { signal } from '@pyreon/reactivity'

function Counter() {
  const count = signal(0)
  return (
    &#x3C;div>
      &#x3C;button onClick={() => count.update((n) => n - 1)}>-&#x3C;/button>
      &#x3C;span>{count()}&#x3C;/span>
      &#x3C;button onClick={() => count.update((n) => n + 1)}>+&#x3C;/button>
    &#x3C;/div>
  )
}
</code></pre>
<p>And here is what <code>transformJSX</code> from <code>@pyreon/compiler</code> turns it into (unedited apart from indentation and the parentheses around the returned expression):</p>
<pre><code class="language-js">import { _tpl, _bindText } from "@pyreon/runtime-dom";
import { signal } from '@pyreon/reactivity'

function Counter() {
  const count = signal(0)
  return _tpl("&#x3C;div>&#x3C;button>-&#x3C;/button>&#x3C;span> &#x3C;/span>&#x3C;button>+&#x3C;/button>&#x3C;/div>", (__root) => {
    const __e0 = __root.firstElementChild;
    const __e1 = __e0.nextElementSibling;
    const __t2 = __e1.firstChild;
    const __e3 = __e1.nextElementSibling;
    __e0.__ev_click = () => count.update((n) => n - 1);
    const __d0 = _bindText(count, __t2);
    __e3.__ev_click = () => count.update((n) => n + 1);
    return __d0
  })
}
</code></pre>
<p>Read it slowly, because the whole runtime model is on screen:</p>
<ol>
<li><strong>The static markup is a string.</strong> <code>_tpl</code> parses it once into a <code>&#x3C;template></code>, caches it, and clones it for every instance. The <code>&#x3C;span> &#x3C;/span></code> carries a single space so the text node already exists in the clone.</li>
<li><strong>The dynamic part is one line.</strong> <code>_bindText(count, __t2)</code> subscribes that text node straight to the <code>count</code> signal. No wrapping closure, no effect object: the compiler saw a bare signal read and handed over the signal itself.</li>
<li><strong>The return value is the cleanup.</strong> <code>__d0</code> unsubscribes the binding on unmount. It is the only thing the component keeps alive.</li>
</ol>
<p>Click <code>+</code> and <code>count</code> notifies its one subscriber, which writes <code>__t2.data</code>. That's the entire update.</p>
<h2>What you stop writing</h2>
<p>In React the same component re-runs on every click. It builds a new element tree, and the reconciler diffs it against the old one to find a single changed character. That model has a real upside (the body is a plain function of state), and it is the reason <code>useMemo</code>, <code>useCallback</code>, <code>memo</code> and dependency arrays exist: every value in the body is recreated on each render, so you have to tell React which ones are stable.</p>
<p>When the body runs once, that whole layer disappears:</p>
<ul>
<li>A handler defined in the body is created once.</li>
<li>A <code>computed()</code> defined in the body is created once and tracks its own dependencies.</li>
<li>There is no dependency array anywhere in the API, because a signal records who read it.</li>
</ul>
<h2>Familiar if you know Solid, with more done for you</h2>
<p>Solid uses the same run-once model, and we're happy to say so. Where Pyreon goes further is in how much the compiler handles for you:</p>
<ul>
<li><strong>Bindings subscribe directly where they can.</strong> For common shapes (a bare signal read, a member call such as <code>row.label()</code>), the runtime gets the signal itself and subscribes the node with no closure in between.</li>
<li><strong>Signal reads in component props become getters.</strong> <code>&#x3C;Greeting name={user().toUpperCase()} /></code> compiles to <code>name={_rp(() => user().toUpperCase())}</code>, and a bare read such as <code>name={user()}</code> to the direct form <code>_rpd(user)</code>. Either becomes a getter on <code>props</code>, so reading <code>props.name</code> inside JSX or an effect subscribes.</li>
<li><strong>A <code>const</code> derived from props stays reactive.</strong> This is the rule people trip on most, so it gets its own section below.</li>
</ul>
<p>On speed between the two, we publish the result even though it goes against us: on our deep component-tree mount benchmark (2,047 components), Solid mounts 1.15–1.18× faster. It is our clearest framework loss, and you will find it on the <a href="https://pyreon.dev/docs/benchmarks">benchmarks page</a> next to our wins. (Apple M3 Max, real Chromium, synthetic, author-run.)</p>
<h2>Live or static: the compiler decides per expression</h2>
<p>Since the body runs once, the question is never "will this re-render?". It is "does this read sit inside something that re-runs?". The <a href="https://pyreon.dev/docs/reactivity-rules">reactivity rules page</a> puts it in one sentence:</p>
<blockquote>
<p>Signal reads inside reactive scopes re-evaluate when the signal changes. Signal reads outside reactive scopes evaluate once and become static.</p>
</blockquote>
<p>A reactive scope is an <code>effect()</code>, a <code>computed()</code>, or a JSX expression the compiler wraps. Feed the compiler one live read and one snapshot side by side and you can watch it decide:</p>
<pre><code class="language-tsx">function Price(props) {
  const total = signal(0)
  const snapshot = total()
  return (
    &#x3C;p class={props.tone}>
      &#x3C;span>{snapshot}&#x3C;/span> / &#x3C;span>{total()}&#x3C;/span>
    &#x3C;/p>
  )
}
</code></pre>
<pre><code class="language-js">return _tpl("&#x3C;p>&#x3C;span>&#x3C;/span> / &#x3C;span> &#x3C;/span>&#x3C;/p>", (__root) => {
  const __e0 = __root.firstChild;
  const __e1 = __e0.nextSibling.nextSibling;
  const __t2 = __e1.firstChild;
  _setChild(__e0, snapshot);                                           // written once
  const __d0 = _bindText(total, __t2);                                 // subscribed
  const __d1 = renderEffect(() => { _setClass(__root, props.tone) });  // subscribed
  return () => { __d0(); __d1() }
})
</code></pre>
<p><code>snapshot</code> is a number captured at setup, so it gets <code>_setChild</code>, a one-time write. <code>total()</code> is a signal read in place, so it gets <code>_bindText</code>. <code>props.tone</code> is a getter read in place, so the class runs in a tracked <code>renderEffect</code>. Same signal, two outcomes, decided by where you read it.</p>
<h3>Destructured props are captured once</h3>
<pre><code class="language-tsx">function Bad({ name }) {
  return &#x3C;p>Hello, {name}&#x3C;/p>
}
</code></pre>
<pre><code class="language-js">return _tpl("&#x3C;p>&#x3C;/p>", (__root) => {
  _setChild(__root, _fuse("Hello, ", name));
  return null
})
</code></pre>
<p><code>name</code> came out of <code>props</code> when the function started, so it is a plain value, and the compiler writes the text once. When the parent changes <code>name</code>, this paragraph stays put. Read <code>props.name</code> instead, or use <code>splitProps(props, ['name'])</code> to carve out a group of props; the pieces it returns keep their getters.</p>
<h3>A <code>const</code> derived from props is inlined</h3>
<p>Here the compiler does more than the usual signals rule of thumb ("never read props outside JSX"):</p>
<pre><code class="language-tsx">function Greeting(props) {
  const name = props.name ?? 'stranger'
  return &#x3C;p class={props.tone}>Hello, {name}!&#x3C;/p>
}
</code></pre>
<pre><code class="language-js">const __d0 = bindPolymorphicText(() => (_fuse("Hello, ", (props.name ?? 'stranger'), "!")), __t0, __root);
const __d1 = renderEffect(() => { _setClass(__root, props.tone) });
</code></pre>
<p>The compiler sees that <code>name</code> is a <code>const</code> whose initializer reads <code>props</code>, so it substitutes the initializer back in at the JSX use site. The whole <code>Hello, …!</code> text is fused into one node and re-reads <code>props.name</code> whenever it changes. It works transitively (<code>const a = props.x; const b = a + 1</code>) and through <code>splitProps</code> results.</p>
<p>It works only for <code>const</code>. A <code>let</code> can be reassigned, so inlining it would be unsound, and the compiler leaves it as a captured value. Outside JSX, <code>console.log(name)</code> still logs the setup value, which is exactly what a plain variable should do.</p>
<p>The parent side:</p>
<pre><code class="language-tsx">function App() {
  const user = signal('Ada')
  return &#x3C;Greeting name={user()} tone="warm" />
}
</code></pre>
<pre><code class="language-js">return &#x3C;Greeting name={_rpd(user)} tone="warm" />
</code></pre>
<p><code>user()</code> became a reactive prop. The literal <code>"warm"</code> stayed a literal, because there is nothing to track.</p>
<blockquote>
<p><strong>You write what you mean, and it stays fast. Nobody has to babysit the renders.</strong></p>
</blockquote>
<h2>The rules on one card</h2>
<table>
<thead>
<tr>
<th>Expression</th>
<th>Live?</th>
<th>Why</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>&#x3C;div>{count()}&#x3C;/div></code></td>
<td>yes</td>
<td>the compiler wraps text children</td>
</tr>
<tr>
<td><code>&#x3C;div class={active() ? 'a' : 'b'} /></code></td>
<td>yes</td>
<td>attributes containing a call are wrapped</td>
</tr>
<tr>
<td><code>&#x3C;Comp title={name()} /></code></td>
<td>yes</td>
<td>compiled to <code>_rp()</code> / <code>_rpd()</code>, a getter on <code>props</code></td>
</tr>
<tr>
<td><code>props.title</code> in JSX</td>
<td>yes</td>
<td>it is a getter</td>
</tr>
<tr>
<td><code>const x = props.title</code>, used in JSX</td>
<td>yes</td>
<td>inlined at the use site</td>
</tr>
<tr>
<td><code>let x = props.title</code></td>
<td>no</td>
<td><code>let</code> is never inlined</td>
</tr>
<tr>
<td><code>const { title } = props</code></td>
<td>no</td>
<td>destructuring copies the value</td>
</tr>
<tr>
<td><code>const x = count()</code> in the body</td>
<td>no</td>
<td>read once, at setup</td>
</tr>
<tr>
<td><code>&#x3C;Show when={() => x()}></code></td>
<td>yes</td>
<td>explicit accessor</td>
</tr>
<tr>
<td><code>&#x3C;For each={items()} by={(i) => i.id}></code></td>
<td>yes</td>
<td>keyed reactive list</td>
</tr>
<tr>
<td><code>items().map(...)</code> in the body</td>
<td>no</td>
<td>evaluated once; use <code>&#x3C;For></code></td>
</tr>
</tbody>
</table>
<p>Two consequences of "the body runs once" surprise people coming from React.</p>
<p><strong>An early return pins the component.</strong> <code>if (loading()) return &#x3C;Skeleton /></code> is evaluated once. If <code>loading</code> was true at mount, that component is a skeleton forever. Use <code>&#x3C;Show when={loading()} fallback={...}></code>, or return an accessor.</p>
<p><strong>Hooks can be conditional.</strong> React forbids <code>if (x) useState()</code> because it identifies hooks by call order across renders. Pyreon has no second render, so a hook is an ordinary function call that has to happen during setup. This is legal:</p>
<pre><code class="language-tsx">function Panel(props: { mode: 'a' | 'b'; count: number }) {
  if (props.mode === 'a') {
    const draft = signal('')
    onMount(() => console.log('mounted a', draft()))
  }
  const cells = []
  for (let i = 0; i &#x3C; props.count; i++) cells.push(signal(i))
  return &#x3C;div>{cells.length}&#x3C;/div>
}
</code></pre>
<p>What is not legal is calling a hook after setup has finished: inside a click handler, a <code>setTimeout</code>, or after an <code>await</code>. By then there is no owner to attach it to.</p>
<h2>Lists: one binding per row</h2>
<p><code>&#x3C;For></code> takes the list and a key function. The key prop is <code>by</code>, because JSX reserves <code>key</code>:</p>
<pre><code class="language-tsx">&#x3C;For each={todos()} by={(t) => t.id}>
  {(t) => &#x3C;li class={t.done() ? 'done' : ''}>{t.title()}&#x3C;/li>}
&#x3C;/For>
</code></pre>
<p>The render callback runs once per new key. Each row's <code>class</code> and text are separate bindings, so toggling one todo's <code>done</code> touches one <code>class</code> attribute on one <code>&#x3C;li></code>. A change to <code>t.title()</code> never re-evaluates <code>t.done()</code>. Reordering the array moves the existing DOM nodes by key without re-running a single callback.</p>
<h2>Three mistakes, and how they show up</h2>
<p>Most "my UI doesn't update" reports come down to three shapes:</p>
<pre><code class="language-tsx">// 1. Calling the signal with an argument does not write it.
count(5)          // a read; the argument is ignored
count.set(5)      // the write

// 2. Capturing a read before the JSX.
const open = isOpen()
return &#x3C;div>{open ? &#x3C;Modal /> : null}&#x3C;/div>      // never changes
return &#x3C;div>{isOpen() ? &#x3C;Modal /> : null}&#x3C;/div>  // live

// 3. A conditional that hides a read.
{() => touched() ? error() ?? '' : ''}
// while touched() is false, error() is never read, so never tracked
</code></pre>
<p>The third one belongs to every fine-grained system (Solid, Preact Signals and MobX behave the same way): an accessor subscribes only to the signals it read on its last run. If <code>touched</code> and <code>error</code> flip in the same batch, the accessor can miss the error. Read both before you branch:</p>
<pre><code class="language-tsx">{() => {
  const t = touched()
  const e = error()
  return t ? e ?? '' : ''
}}
</code></pre>
<p>You won't hunt for the first two by hand. <code>@pyreon/lint</code> flags destructured props and <code>count(5)</code>, and the Reactivity Lens (served by <code>pyreon-lint --lsp</code>) prints <code>live</code> or <code>static</code> next to JSX expressions in your editor, straight from the compiler's own analysis. That tooling gets its own post on 14 December.</p>
<h2>What this model costs</h2>
<p>We publish where we lose, so you can trust where we win. Here is the price of run-once, straight from the benchmark record (Apple M3 Max, synthetic, author-run; reproduce it from the <a href="https://pyreon.dev/docs/benchmarks">benchmarks page</a>):</p>
<ul>
<li><strong>Creating a signal is about 5× slower than in Preact Signals</strong> on both V8 and JavaScriptCore (63 vs 13 ns per create+read+write on V8). An app that creates huge numbers of short-lived signals will feel it.</li>
<li><strong>Deep component trees mount 1.15–1.18× slower than in Solid.</strong> The profiled cost is the per-component reactive-props getter chain, not element creation. A null-prototype props object shipped in November and narrowed the gap without closing it. A newer compiler change forwards pass-through props without adding a getter per level; it landed after the record was taken, so its effect is not in the published numbers yet.</li>
<li><strong>Bundle:</strong> the same keyed-table app is 17.2 KB gzipped in Pyreon, against 7.5 KB for Solid and 10.1 KB for Preact.</li>
</ul>
<p>And on the design side:</p>
<ul>
<li><strong>Static-by-default reads take a little learning.</strong> A React developer expects everything in the body to be current. Here, a plain read in the body is a snapshot. The compiler and the lint rules catch the common forms; a read buried in non-JSX code (a <code>.filter()</code> over a signal in the body, say) is still yours to wrap in <code>computed()</code>.</li>
<li><strong>Prefer to skip the rules entirely?</strong> Plain Mode (experimental) lets you write <code>let count = state(0); count++</code> with destructured props that stay live, and the <code>'use plain'</code> dialect compiles it to the same signal code. This post covers the default dialect.</li>
<li><strong>Pyreon is pre-1.0.</strong> Breaking changes ship as minor versions.</li>
</ul>
<p>Want to check any of this yourself? Paste a component into <code>transformJSX</code> (exported from <code>@pyreon/compiler</code>) and read what comes back. These rules are not conventions we ask you to follow. They are what the compiler emits.</p>
<h2>Build something with it</h2>
<pre><code class="language-bash">npm create @pyreon/zero@latest
</code></pre>
<ul>
<li>The full rules, every edge case: <a href="https://pyreon.dev/docs/reactivity-rules">reactivity rules</a></li>
<li>Docs: <a href="https://pyreon.dev/docs">pyreon.dev/docs</a></li>
<li>Star the repo: <a href="https://github.com/pyreon/pyreon">github.com/pyreon/pyreon</a></li>
<li>Questions, ideas, a bug: open an issue on <a href="https://github.com/pyreon/pyreon/issues">GitHub</a>, where every answer stays findable for the next person.</li>
</ul>]]></content:encoded>
    </item>
  </channel>
</rss>
