← All posts

Why I Build My Frontends in Svelte

I build my frontends in Svelte, which is a less common choice than React. Three of my projects use it. All three started on Svelte 5 with runes, so none has needed a migration from the older syntax.

Svelte gave me less boilerplate and small static builds. It costs a smaller ecosystem and a smaller pool of people who already know it. In the 2025 Stack Overflow survey, 44.7% of respondents had done extensive work in React in the past year, and 7.2% in Svelte.

In short

  • Svelte is a compiler. In the lab, a small counter compiles to 537 bytes of direct DOM updates.
  • Built with the same bundler, the same counter is 19,232 B gzip in Svelte 5.56.10 and 69,187 B in React 19.3.1. In Lighthouse both score 100, and the Svelte page's largest paint comes 0.3 s sooner on simulated mobile. A counter is a tiny app.
  • Svelte 5 runes ($state, $derived, $effect, $props) replace let, $: and export let. Svelte 4 code still compiles by default.
  • In my three frontends, $derived appears between about 4.6 and 30 times as often as $effect.
  • The costs: a smaller ecosystem and hiring pool, fewer ready-made component libraries, a syntax change between versions 4 and 5, and SvelteKit settings that must match the hosting.

What Svelte is

The Svelte docs call it "a framework for building user interfaces on the web" that "uses a compiler to turn declarative components written in HTML, CSS and JavaScript" into "lean, tightly optimized JavaScript". The markup becomes a template that is cloned once. Each reactive value gets code that writes to the one text node or attribute it feeds. In the lab, the compiled counter contains no virtual DOM tree.

Two lanes of boxes. Top lane, Svelte: component file, Svelte compiler at build time, plain JavaScript, DOM. Bottom lane, React as its documentation describes it: component, rendered output compared with the last one, commit with minimal DOM operations, DOM. Where the work happens: Svelte at build time, a runtime library at run time Svelte (the lab's Counter.svelte, 152 bytes of source) Component file script, markup, style Svelte compiler at build time Plain JavaScript 537 bytes in the lab DOM text node set A component function that renders, then a commit step (React's documented model) Component called to render Rendered output compared with last Commit minimal DOM operations DOM Top lane: the update path is decided when the file is compiled. Bottom lane: described in React's docs, 'Render and commit'.
Figure 1. Where the work happens. The top lane is measured in the lab. The bottom lane follows the React page on rendering and committing.

React works another way. Rendering is "React calling your components", and the commit step "will apply the minimal necessary operations" to make the DOM match. That is a runtime model, and it is not a flaw. React also moves work to the build: React Compiler applies "the equivalent of manual memoization" automatically. Without it, a state change re-renders the component and all its children unless you memoise.

Svelte 5 and runes

Svelte 5 became stable on 22 October 2024 and is "almost completely backwards-compatible with Svelte 4". Runes were introduced in a post of 20 September 2023. It lists the problems they fix. Svelte 4 reactivity worked only for top-level let declarations. Code behaved one way in .svelte files and another in .js. A $: statement could only "see" the variables named in it. The store API "can get rather unwieldy when you start doing more complex things".

A line from April 2019 to October 2024 with four marked points: Svelte 3 on 2019-04-22, Svelte 4 on 2023-06-22, the runes post on 2023-09-20 and Svelte 5 on 2024-10-22. Svelte releases and the runes post, with dates from the Svelte blog Svelte 3 2019-04-22 Svelte 4 2023-06-22 Runes post 2023-09-20 Svelte 5 2024-10-22 Svelte 3 to Svelte 4 took about four years; Svelte 4 to Svelte 5 about sixteen months.
Figure 2. Release dates from the Svelte blog posts. The gaps are computed from them.

The migration guide maps old forms to new ones, shown below. Old and new components can be mixed. The migration script (npx sv migrate svelte-5) does not convert createEventDispatcher or beforeUpdate and afterUpdate.

Svelte 4Svelte 5Note from the migration guide
let count = 0let count = $state(0)A variable is reactive when created with $state.
$: double = count * 2const double = $derived(count * 2)$derived replaces derivations.
$: { sideEffect(count) }$effect(() => sideEffect(count))$effect replaces side effects.
export let namelet { name } = $props()All properties come through $props, by destructuring.
on:click={fn}onclick={fn}Handlers are properties like any other.
createEventDispatchercallback propsDeprecated; the migration script does not convert it.
<slot />{@render children()}Snippets replace slots.
storesa class or object with $state in a .svelte.js fileThe guide page does not cover stores. The runes post calls the store API “unwieldy” for complex cases.

For deep state, the $state page says an array or simple object becomes "a deeply reactive state proxy". "Class instances are not proxied", but a class can use $state in its fields. Runes are compiler syntax, so they work only in .svelte, .svelte.js and .svelte.ts files. In the lab, the same text run as plain JavaScript fails with "$state is not defined".

The same component in Svelte and React

Here is one small component in each: a counter with a derived value, an effect that sets the page title, and a list you can add to. I wrote both for this post. As written, the Svelte file is 17 lines and the React file is 23.

<script>
  let count = $state(0);
  let items = $state(['a', 'b']);
  const double = $derived(count * 2);

  $effect(() => {
    document.title = `count ${count}`;
  });
</script>

<button onclick={() => count++}>{count} doubled is {double}</button>
<button onclick={() => items.push('x' + items.length)}>add</button>
<ul>
  {#each items as item}
    <li>{item}</li>
  {/each}
</ul>
import { useState, useMemo, useEffect } from 'react';

export default function Counter() {
  const [count, setCount] = useState(0);
  const [items, setItems] = useState(['a', 'b']);
  const double = useMemo(() => count * 2, [count]);

  useEffect(() => {
    document.title = `count ${count}`;
  }, [count]);

  return (
    <>
      <button onClick={() => setCount(count + 1)}>{count} doubled is {double}</button>
      <button onClick={() => setItems([...items, 'x' + items.length])}>add</button>
      <ul>
        {items.map((item) => (
          <li key={item}>{item}</li>
        ))}
      </ul>
    </>
  );
}

The difference is mostly in the list and the derived value. Svelte mutates the array and tracks the change. React needs a new array and a dependency list for useMemo and useEffect.

Two lanes. Svelte: items.push, then the $state proxy marks the each block dirty, then one li is appended. React: setItems with a new array, then Counter runs and builds the whole JSX, then a comparison by key with the last render, then a commit inserts one li One click on "add": what runs in each framework Svelte 5: the write itself is tracked items.push('x2') mutate the $state array $state proxy marks the {#each} block dirty DOM one <li> appended React: the component runs again, then the result is compared setItems([...items, 'x2']) a new array Counter() runs builds the whole JSX Compare by key with the last render Commit one <li> inserted Both end with one new <li>. They differ in the work before it: Svelte knows the target when it compiles, React re-runs the component and its children unless they are memoised (React docs, 'Render and commit').
Figure 3. What one click on add runs in each framework.

I also built both with the same bundler and settings: esbuild, minified, production mode, ES module output. The table gives the result.

Same counter, esbuild, minifiedSvelte 5.56.10React 19.3.1 + react-dom 19.3.1
Source lines as written1723
Bundle, raw51,688 B223,893 B
Bundle, gzip level 919,232 B69,187 B

A counter is a tiny app. The React figure is mostly the library, and the Svelte figure is mostly its runtime, so both are fixed costs that matter less as an app grows. For scale, the genealogy site's whole client is about 104 kB gzip (see the build table below), and that is a different build tool.

I also ran Lighthouse 12.8.2 on both builds, five times each, with its default mobile settings: a simulated slow 4G network and a CPU four times slower. A local server sent both pages gzipped. The table gives the medians, and the five runs of each page were within 4 ms of each other.

Lighthouse, mobileSvelte 5.56.10React 19.3.1
Performance score100100
First contentful paint0.90 s1.05 s
Largest contentful paint0.90 s1.20 s
Total blocking time0 ms0 ms
Transferred, gzip20,025 B70,170 B

Both pages score 100, and neither blocks the main thread. The Svelte page shows its content 0.15 s sooner at first paint and 0.30 s sooner at largest paint, which follows the extra 50 kB the React page sends over the simulated network. These are simulated timings for a counter, not a measure of either framework in a real app.

Three pairs of horizontal bars, Svelte above React: raw bundle 51.7 against 223.9 kB, gzip sent 20.0 against 70.2 kB, largest contentful paint 0.90 against 1.20 s The same counter in Svelte 5 and React 19: size and Lighthouse (mobile, median of 5) Bundle, raw (kB) Svelte 51.7 React 223.9 Sent, gzip (kB) Svelte 20.0 React 70.2 Largest paint (s) Svelte 0.90 React 1.20 Each pair is scaled to its larger value. Both pages scored 100 and blocked the main thread for 0 ms. A counter is a tiny app: these are mostly fixed costs of each framework, not of an application.
Figure 4. The same counter in both frameworks: size and Lighthouse timings from the lab.

A worked trace

The lab's Series class has three $state fields and three $derived values. Each derived value counts how often it runs. After one write to title, one derived value runs again. A model that re-runs everything would run three.

const s = new Series();   // values, unit, title: $state; total, mean, label: $derived
s.title = 'level';        // 1 write
// total: depends on values only          -> not marked, not run
// mean:  depends on total and values     -> not marked, not run
// label: depends on title and unit       -> marked dirty, runs on next read
StepWhat happensRuns again?
Startvalues, unit, title are $state; total, mean, label are $derivednone yet: derived values are lazy
First read of all threeeach derived value is computed oncetotal 1, mean 1, label 1
title = 'level'only label reads title, so only it is marked stalelabel on its next read
Second read of all threetotal and mean return their stored valueslabel 2, total 1, mean 1
A dependency graph. Three state boxes, values, unit and title, feed three derived boxes, total, mean and label, and an effect reads title and unit. Title and label are highlighted as the written and recomputed nodes. Runes build a dependency graph: a write reaches only what reads it values $state unit $state title $state (written) total $derived mean $derived label $derived (recomputed) effect reads title and unit Lab result: after one write to title, label ran again; total and mean did not (1 of 3 recomputed, against 3 of 3 in a re-run-everything model).
Figure 5. The runes graph in the lab's Series class. Only the boxes downstream of the written node run again.

Two more lab results. A value read twice is computed once. An effect that reads two fields runs once after two writes.

SvelteKit, plain Vite and adapter-static

Svelte renders components. SvelteKit adds "a router that updates your UI when a link is clicked", server-side rendering and "build optimizations to load only the minimal required code". A plain Vite project with the Svelte plugin gives you components and a bundler, and you add routing yourself.

adapter-static "will prerender your entire site as a collection of static files", which any file host can serve. The root layout must set prerender. Keep ssr on when pages should carry their content: with ssr false, prerendering "saves an empty shell page". A dashboard rendered in the browser wants exactly that (pattern 5 below); a content site does not. The fallback option makes a single-page app, but it "has large negative performance and SEO impacts". By default the adapter checks that every page is prerendered or a fallback is set.

Three boxes for the page options prerender, ssr and csr, each with a short meaning. Below, the settings of the surveyed projects: the genealogy site prerenders everything with ssr off on one page, the cockpit prerenders with ssr off, the tree viewer does not use SvelteKit. SvelteKit page options and what adapter-static needs prerender build the page to a file adapter-static needs it ssr render HTML on the server false gives an empty shell csr hydrate in the browser false ships no JavaScript Both ssr and csr false: nothing is rendered. adapter-static (strict) checks that every page is prerendered or that a fallback is set. The fallback option has large negative performance and SEO impacts. Settings in the surveyed projects Genealogy site prerender true in the root layout; ssr false on one preview page; csr default Research cockpit prerender true and ssr false in the root layout; csr default Tree viewer not SvelteKit: Vite and the Svelte plugin, a single-page app
Figure 6. SvelteKit page options, from the docs, and the settings each surveyed project uses.
import adapter from '@sveltejs/adapter-static';

export default {
  kit: {
    adapter: adapter({ pages: 'build', assets: 'build', fallback: '404.html', strict: true }),
    prerender: { entries: ['*', '/sitemap.xml'], handleHttpError: 'fail' }
  }
};
A flow of boxes. Backend, data layer, state module and components in a row. Below, the state module feeds Vite with the Svelte plugin, which produces static files, and adapter-static joins the same step for SvelteKit. A generic shape for the three frontends: data in, state module, components, static files out Backend JSON files or an API Data layer fetch, typed client State module $state, $derived, class Components SVG, tables, forms Vite + Svelte plugin compile and bundle Static files html, js, css adapter-static prerender (SvelteKit) One surveyed site is SvelteKit with adapter-static, one is Vite with the Svelte plugin only, one is SvelteKit rendered in the browser.
Figure 7. A generic shape for the three frontends. The data layer is either static JSON read at build time or a typed client calling an API.

Three frontends, measured

The three projects are a genealogy project's website, a Y-DNA tree viewer whose code is closed, and a private research cockpit. The first uses SvelteKit with adapter-static. The second uses Vite with the Svelte plugin and no SvelteKit. The third is SvelteKit built as a static shell that renders in the browser. Counts are lines of the tracked .svelte files. Sizes come from production builds already on disk. Gzip sizes are approximate: I concatenated each build's JavaScript and compressed it at the default level.

Genealogy siteTree viewerResearch cockpit
ToolingSvelteKit, adapter-staticVite + Svelte pluginSvelteKit, adapter-static, browser-rendered
Svelte5.56.105.56.85.57.3
SvelteKit / Vite2.70.3 / 8.2.2none / 8.1.53.1.1 / 8.3.6
TypeScript6.0.36.0.36.0.3
Svelte adopted2026 (November)2026 (July)2026 (November)
Runes from first commityesyesyes
Components (.svelte files)586839
Lines in those files5,07625,6325,095
Lines of TypeScript (tests included)1,62439,4648,518
Svelte 4 store APInot usednot usednot used
Shared statecomponents, two module objectsrune modulesclass passed by context
Backendstatic JSON at build timefetch, same origintyped fetch, event stream

I searched each history for export let and found nothing. $state appears in each project's first Svelte commit. So there is no runes migration in any of them, and I cannot report its cost. All three are from 2026, so they say little about how Svelte ages.

Production build on diskScript filesJavaScriptJavaScript, gzipCSS
Genealogy site (39 pages)55255,462 B103,760 B79,162 B
Tree viewer361,037,931 B363,452 Bnot measured
Research cockpit12280,305 B92,592 B55,256 B
Bars of raw and gzip JavaScript size in kilobytes for three projects: genealogy site 255.5 and 103.8, tree viewer 1037.9 and 363.5, research cockpit 280.3 and 92.6. Production JavaScript per project, kB (approximate) Genealogy site 255.5 raw 103.8 gzip Tree viewer 1,037.9 raw 363.5 gzip Research cockpit 280.3 raw 92.6 gzip kB here means 1,000 bytes. The tree viewer is the largest application and loads its views on demand.
Figure 8. Production JavaScript per project. Approximate.

The tree viewer is the largest application, and its views load on demand. The table gives its total over 36 chunks, not what one page loads. The genealogy site's 39 HTML files share its 55 script files. The cockpit's client is 12 script files. I did not build React versions of these projects, so none of this compares the two.

Three stacked bar groups, one per project, counting .svelte files in five size bands from under 50 lines to 400 or more. Genealogy site: 31, 12, 9, 4, 2. Tree viewer: 4, 12, 8, 23, 21. Research cockpit: 8, 10, 12, 9, 0. Lines per .svelte file: number of files in each size band Genealogy site (58 files), median 46.5 lines under 50 31 50 to 99 12 100 to 199 9 200 to 399 4 400 or more 2 Tree viewer (68 files), median 305 lines under 50 4 50 to 99 12 100 to 199 8 200 to 399 23 400 or more 21 Research cockpit (39 files), median 110 lines under 50 8 50 to 99 10 100 to 199 12 200 to 399 9 400 or more 0 Files include their script, markup and style. Largest file: 956, 1,665 and 312 lines in that order.
Figure 9. Component sizes. The genealogy site has many small files, the tree viewer many large ones.

Patterns from the code

Five patterns recur. The snippets are new, written to show the idea.

1. Shared state as a module. One $state object in a .svelte.ts file, with small functions that write to it. The tree viewer has eight such modules and no stores. The genealogy site has two.

// highlight.svelte.ts: shared state as one $state object plus small functions that write to it.
export const highlight = $state({ ids: new Set<string>(), label: null as string | null, epoch: 0 });

export function setHighlight(ids: string[], label: string): void {
  highlight.ids = new Set(ids);
  highlight.label = label;
  highlight.epoch += 1; // views react to a new request, not only a changed set
}

2. A class with runes in its fields. The cockpit wraps each remote value in a class that holds data, error and loading. It drops answers from older requests and keeps old data when a refresh fails. The lab tests it without a browser.

// One remote value: loading until the first answer, then the data or an error message.
// The newest request wins, an older answer that arrives late is dropped, and old data
// stays on screen if a refresh fails.
export class Resource {
  data = $state(null);
  error = $state(null);
  loading = $state(true);
  #latest = 0;
  #load;

  constructor(load) {
    this.#load = load;
  }

  async refresh() {
    const mine = ++this.#latest;
    try {
      const data = await this.#load();
      if (mine !== this.#latest) return;
      this.data = data;
      this.error = null;
    } catch (e) {
      if (mine !== this.#latest) return;
      this.error = e instanceof Error ? e.message : String(e);
    } finally {
      if (mine === this.#latest) this.loading = false;
    }
  }
}

3. Context for the store. The cockpit creates one such object in the layout and passes it down with Svelte's context API. The getter fails loudly if the layout is missing.

import { getContext, setContext } from 'svelte';
import type { Cockpit } from './cockpit.svelte';

const KEY = Symbol('cockpit');

export const setCockpit = (c: Cockpit): Cockpit => setContext(KEY, c);

export function getCockpit(): Cockpit {
  const c = getContext<Cockpit | undefined>(KEY);
  if (!c) throw new Error('Cockpit context missing: wrap the page in +layout.svelte');
  return c;
}

4. A derived layout for an SVG chart. Geometry lives in a plain TypeScript function. The component derives its points from the data and its measured width. At least two of the three projects draw charts by hand, in SVG or on a canvas.

<script lang="ts">
  import { layout, W, H, type Series } from '$lib/chart';

  let { series }: { series: Series[] } = $props();
  let box = $state(0); // rendered width, bound below

  // Recomputed only when `series` or `box` change.
  const geo = $derived(layout(series, box > 0 ? Math.max(300, Math.round(box)) : W));
</script>

<figure bind:clientWidth={box}>
  <svg viewBox="0 0 {geo.width} {H}" role="img" aria-label="Line chart">
    {#each geo.series as s}
      <polyline points={s.points} fill="none" stroke="currentColor" />
    {/each}
  </svg>
</figure>
A line through five points at heights 3, 5, 4, 8 and 6, with a dashed baseline at zero. The lab's Chart.svelte, rendered to a string on the server (values 3, 5, 4, 8, 6) 3 5 4 8 6 Zero is the bottom edge (y = 136 in the chart's own 360 by 160 box) and the maximum the top edge (y = 24); the lab tests both.
Figure 10. The lab's Chart.svelte after server rendering. The test checks these points.

5. A browser-rendered shell. For a dashboard whose data exists only at run time, two lines in the layout give a static shell: prerender the page, and do not render it on the server.

// +layout.ts of a browser-rendered dashboard: one prerendered shell, data fetched at run time.
export const prerender = true;
export const ssr = false;
Horizontal bars. Genealogy site: 103 derived and 22 effect. Tree viewer: 498 derived and 109 effect. Research cockpit: 148 derived and 5 effect. Uses of $derived and $effect in each frontend's source (text search, includes comments) Genealogy site 103 $derived 22 $effect Tree viewer 498 $derived 109 $effect Research cockpit 148 $derived 5 $effect Counted with grep over src. The ratio runs from about 4.6 to 1 to about 30 to 1.
Figure 11. Text counts over each frontend's source, comments included. They show a habit, not quality.

None of the three uses the Svelte 4 store API. The genealogy site keeps runes in components plus two module objects. The tree viewer uses component runes and rune modules. The cockpit passes a class-based store by context.

For backends, the genealogy site reads static JSON at build time and fetches only a search index at run time. The tree viewer calls its API with fetch from the same origin. The cockpit uses a typed fetch client generated from the API's schema, a server-sent event stream and periodic refreshes. All three test with Vitest. The genealogy site adds build-level checks. The tree viewer uses happy-dom. The cockpit uses jsdom and Testing Library, with tests beside the components.

Pros and cons

Sources are in parentheses.

Pros (with source)Cons (with source)
Components compile to “lean, tightly optimized JavaScript” (Svelte docs, overview).Smaller user base: React 44.7% and Svelte 7.2% of all respondents with extensive work in the past year; among professional developers 46.9% and 6.9% (Stack Overflow Developer Survey 2025).
With runes “you can write less code” (Svelte blog, “Introducing runes”, 20 September 2023).Fewer people use it at work: 8,548 respondents used React and 1,409 used Svelte (State of JavaScript 2024). That points to a smaller hiring pool and fewer libraries.
Fine-grained updates: “changes to a value inside a large list needn't invalidate all the other members” (same blog post).Syntax change: slots, events and export let have new forms in Svelte 5, and the migration script does not convert createEventDispatcher, beforeUpdate or afterUpdate (Svelte 5 migration guide).
adapter-static “will prerender your entire site as a collection of static files” (SvelteKit docs).Settings must match hosting: with ssr off, prerendering “saves an empty shell page”, and the fallback option “has large negative performance and SEO impacts” (SvelteKit docs, adapter-static).
Svelte 5 is “almost completely backwards-compatible with Svelte 4” (Svelte blog, 22 October 2024).Compiler-only syntax: runes work in .svelte and .svelte.js files, not plain modules (lab test; $state is not defined).

Why I chose it

I tried React before and disliked it. For what I build it felt heavier than the work needed. Three reasons sit behind that, and they are the pros that mattered to me.

Less code and a plain feel. I wanted less code and something close to plain HTML, CSS and JavaScript: no JSX, no rules of hooks, less boilerplate. This matches the documented pro that runes mean you "can write less code". The evidence supports it only partly. A component is one file with script, markup and style, and the counter above is 17 lines against 23. But I did not rewrite any project in React, so I cannot put a figure on the saving, and the tree viewer's components are long: its tracked .svelte files have a median of 305 lines, including their styles.

Small, fast static builds. I like that the framework compiles away and that the sites host anywhere through adapter-static. That is the compiler pro and the static-files pro from the table. The evidence: the counter bundles to 19.2 kB gzip in Svelte against 69.2 kB in React, and the genealogy site serves 39 prerendered pages from 55 script files. The tree viewer is the counter-example: about 1,038 kB of JavaScript across 36 chunks, which is the size of its features, not of its framework.

Easy for a backend and ML engineer, and productive alone. Svelte lets me be productive by myself on side projects. Two of the three projects hold more TypeScript than Svelte markup (the tree viewer and the cockpit), and the cockpit's store is an ordinary class. That is consistent with state and logic living in plain code, though it does not prove ease of learning.

The cost side. The repositories show one cost: the genealogy site's history has a commit that fixes pages failing to hydrate by using one Svelte version. That is a dependency problem, not a language one. They show no runes migration, because none of the three needed one. The smaller ecosystem and hiring pool are general trade-offs that follow from the survey figures above. The tree viewer uses a mapping library and a flags package that do not depend on a framework, and at least two projects draw their charts by hand. My records do not say whether that was a choice or a lack of options.

When I would not pick Svelte

  • When the team or the people I hand it to know React. The hiring pool is smaller (Stack Overflow 2025, State of JavaScript 2024).
  • When the project needs many ready-made component libraries. Fewer users point to fewer of them.
  • When I have a large Svelte 4 codebase built on slots and event dispatchers and no time to port it. The migration script does not do all of it.
  • When I cannot prerender the pages. adapter-static needs prerendered pages or a fallback, and the fallback has large negative performance and SEO impacts.
A flow of three questions. Will people who know React maintain it? If yes, React. Does it need many ready-made components? If yes, React or check Svelte libraries first. Can every page be prerendered? If yes, SvelteKit with adapter-static. If not, is the data known only at run time? If yes, a prerendered shell with ssr off; if not, SvelteKit with a server adapter A new frontend: when I reach for Svelte, and when I do not 1. Will people who know React maintain it? a team, or whoever I hand it to 2. Does it need many ready-made components? date pickers, data grids, design systems 3. Can every page be prerendered? content known at build time no no yes React the larger pool and library choice yes React, or check Svelte's libraries first fewer users point to fewer of them yes SvelteKit + adapter-static the genealogy site no 4. Is the data known only at run time? a dashboard fed by an API yes Prerendered shell, ssr off the research cockpit no SvelteKit with a server adapter pages rendered on request A large Svelte 4 codebase can stay as it is: Svelte 5 still compiles the old syntax by default.
Figure 12. The list above as a decision flow, with the project that uses each Svelte route.

A small lab you can run

The lab is a folder with Svelte 5 and a few files, and no bundler. A script compiles the sources with Svelte's own compiler, and the tests check each claim above against the alternative it rejects.

  • store.svelte.js: the Series class. Tests cover lazy evaluation, one recomputation against three, deep reactivity on push and one effect run after two writes.
  • resource.svelte.js: the pattern-2 class. A late answer to an older request is dropped, and a failed refresh keeps the old data.
  • Counter.svelte, compiled for the client: the output is a cloned template and a text write, with no virtual nodes.
  • Chart.svelte, compiled for the server: it renders to a string with the right point count and points attribute.
  • Legacy.svelte in the Svelte 4 style: it compiles by default and is refused with runes: true.
  • The counter built with Svelte 5 and with React 19 by esbuild: sizes are identical on two builds, and the React bundle is larger. An optional script runs Lighthouse on both.

Run npm install and npm test, or python -m pytest -q. It passes 15 tests. node --conditions browser demo.js prints the compiled counter and the chart string. node --conditions browser bundle.js prints the bundle sizes, and node lighthouse.js repeats the Lighthouse runs if Chrome is installed.

Limits of this post

  • The three projects are small to medium and from 2026. They show how I use Svelte, not how it behaves in a large team or over years.
  • Apart from the counter's bundle size and its simulated Lighthouse timings, there is no React comparison, so nothing here says Svelte is faster or smaller than React for a real application.
  • Gzip figures are approximate, and I did not measure what a single page downloads.
  • Rune counts are text matches, comments included.
  • The Stack Overflow figure measures extensive work in the past year, not hiring supply.

Sources