# Performance

> What is measured, what is not claimed, the five shipping invariants, and links to methodology, budgets and results.

Page: https://svelte-lean.vercel.app/performance · Markdown: https://svelte-lean.vercel.app/performance.md · Index: https://svelte-lean.vercel.app/llms.txt

Every number in this section is read from a file a script in this repository writes; a missing file reads not measured.

## Key numbers

| Subject | Value | Source |
| --- | --- | --- |
| Behavior JavaScript of a page with native primitives only (button, dialog, popover) | 0 B | `native-only` fixture |
| Tabs behavior with the shared kernel, for any number of tab lists | 1839 B brotli | [Budgets](https://svelte-lean.vercel.app/performance/budgets.md) |
| A thousand tabs roots: ready, first click | 68.6 ms, 1.9 ms | [Results](https://svelte-lean.vercel.app/performance/results.md) |
| Table, a thousand rows: mount, sort | 287.3 ms, 156.1 ms | [Results](https://svelte-lean.vercel.app/performance/results.md#table-1000-rows) |
| Modal dialog, library JavaScript: Svelte Lean, Bits UI | 0 B brotli, 12378 B brotli | [Comparison](https://svelte-lean.vercel.app/docs/why-not-bits-ui.md#measured) |

Production builds, Vite 7.3.6, Svelte 5.57.1; timings are medians in Chromium on AMD EPYC 9555P 64-Core Processor; the comparison excludes Svelte's own runtime on both sides (Bits UI 2.19.3).

## What is measured

- Bytes of every entry point (raw, gzip, brotli) against its budget.
- What consumer applications ship, asserted module by module in production builds.
- Listeners at one and a thousand roots, counted by the runtime and by an independent `addEventListener` wrapper.
- Startup and interaction timings, each as its own entry, never one score.
- Heap, DOM nodes and listeners after repeated mount and unmount.

## What is not claimed

- No comparison beyond the published one: the Bits UI cases in benchmarks/compare, with their source and versions.
- No cross-browser numbers: Chromium only; Firefox and WebKit runs do not exist yet.
- No promise from a timing: it describes the recorded environment.

Every public claim and its evidence: docs/proof/claims.md.

## Shipping invariants

Release-blocking, from ADR 0005.

| Invariant | Where it is tested | Status |
| --- | --- | --- |
| A. Native-only pages ship no behavior runtime | fixtures/native-only; packages/primitives/scripts/size.mjs (native-only build) | passing |
| B. Unused behaviors are absent from production output | fixtures/tabs-only, tabs-and-menu, manual-registration, table-basic | passing |
| C. Instance count does not multiply shared listeners | apps/playground/tests/primitives/listeners.spec.ts (1 versus 1000 roots); packages/primitives/tests/tabs.test.ts | exact assertion in the browser suite |
| D. Tier 2 state is lazy | packages/primitives/tests/autocomplete.test.ts and select.test.ts; apps/playground/tests/primitives/lazy.spec.ts (no controller until a root is used, released on close) | exact assertion in the browser suite |
| E. Compatibility code is opt-in | No compatibility module exists yet; the first one comes with a fixture. | not applicable yet |

Fixture status from `fixtures/results.json` (`yarn test:fixtures`, Node v22.23.3).

## Proof hierarchy

| Level | What it proves | Where |
| --- | --- | --- |
| Level 1 · Architecture | Each contract declares tier, events and native base; tests assert the root entry registers nothing. | packages/primitives/src/\<name\>/contract.md and contract.ts |
| Level 2 · Build | Consumer fixtures assert which modules ship; size scripts record every entry point. | fixtures/results.json, packages/\*/artifacts/size.json |
| Level 3 · Runtime | Listener counts at one and a thousand roots, keyboard and focus, JavaScript disabled, timings. | apps/playground/tests, and live on the proof page of this site |
| Level 4 · Application | This site runs on the packages it documents; the Settings demo composes primitives and the table. | apps/docs, /demos/settings |

## Read next

- [Methodology](https://svelte-lean.vercel.app/performance/methodology.md): how each number is produced and reproduced.
- [Budgets](https://svelte-lean.vercel.app/performance/budgets.md): the limit next to each measured size.
- [Results](https://svelte-lean.vercel.app/performance/results.md): every measurement with its environment.
- [Proof](https://svelte-lean.vercel.app/proof.md): the live runtime of this site.
