Scale
Measured on a generated app of 104,495 lines in 1,310 files: 1,000 routes, 300 components (a
tree: every page renders the header, the root of all 300), one store. The generator and the
scripts are in benchmarks/scale; numbers from an 11-core Apple Silicon laptop, Node 22.
The table is one run, of 2026-10-20 (benchmarks/scale/results/phase-5.json and
phase-5-vscode.json), not repeated since. The sections below were measured later, each with its
file: a clean compress is 3.00 s there, not 2.8 s.
| Measured (median) | Target | |
|---|---|---|
qatjs dev cold start (server ready) |
12 ms (53 ms including Node's own start) | < 300 ms |
| HMR, a leaf component | 18 ms (9–21) | < 50 ms |
| HMR, the shared header (re-creates its 300-component subtree) | 38 ms (31–44) | < 50 ms |
qatjs compress (1,000 route chunks) |
2.8 s | < 5 s |
qatjs check (compiler + TypeScript) |
11.1 s (compiler checks alone: 2.3 s) | < 15 s |
completion in VS Code on a 2,045-line .qx, after an edit |
98 ms (p95 140 ms; first 68 ms) | < 200 ms |
The first page in dev
The first run measured the first page at 870 ms: it loads the header's 300-component subtree as about 300
separate modules, each compiled on its first request. Now (median of 5; "in page" is navigation
to the page's <h1> in the DOM, "with driver" adds Playwright's round trips, as in the first run):
First page (/p500) |
in page | with driver | target |
|---|---|---|---|
a later qatjs dev start (compiled components kept), HTTP/1.1 |
182 ms | 216 ms | < 300 ms |
the same, HTTP/2 (--https) |
189 ms | 226 ms | < 300 ms |
the first start on a machine (--force: nothing kept), HTTP/1.1 |
385 ms | 419 ms | < 300 ms (missed) |
| the same, HTTP/2 | 368 ms | 418 ms | < 300 ms (missed) |
What changed, in the order of the remedy rule (D115):
- The compiler, profiled: 41% of a component's compile was the generic AST walk rebuilding every node's child list on each of a dozen passes. Child lists are now computed once per compile, and the parser hands over its AST without a JSON round trip (oxc's raw transfer). 300 components: 539 → 315 ms.
- No waterfall: the page carries
modulepreloadhints for its route's whole module set, and the server starts compiling all of them when the page is requested. - A worker pool (4 workers for this app: past four, each compile slows down on this machine).
- Nothing compiled twice: compiled components are kept in
node_modules/.qat/transformacross restarts. - HTTP/2 (
qatjs dev --https): measured, it hardly matters on localhost once the server keeps up.
The first start on a fresh machine still misses the target: about 130 ms of compiling, 70 ms of rendering 300 components, and the rest is module evaluation. That stays an open issue; dev is not bundled.
Compress
Measured with benchmarks/scale/compress.mjs (medians of 5 on the same laptop, while other builds
ran on it). The scale app ships 1,106 chunks: 1,000 pages, about 100 chunks of components (each
component under 3 kB is merged into its most common requester of the same route set, so the
300-component tree becomes subtrees of 3–8 kB), the runtime, the route table.
What a returning visitor downloads again after one edit (gzip; every file whose name is new):
| edit | before (chunk-level hashes) | after (content addressing through the import map) |
|---|---|---|
a leaf component (c299.qx) |
1,003 files, 1,250 kB = 99.4 % | 1 file, 1.4 kB = 0.11 % |
the shared header (c0.qx, every page) |
1,003 files, 1,250 kB = 99.4 % | 1 file, 1.6 kB = 0.12 % |
the store (session.js) |
1,003 files, 1,251 kB = 99.4 % | 1 file, 1.6 kB = 0.12 % |
Before, every chunk named its imports by their hashes, so one change re-addressed every importer up to the entry. The price: index.html carries the import map (81 kB gzip instead of 61 kB; it is the one file always downloaded), and all the JavaScript is 1,371 kB instead of 1,257 kB gzip (+9 %: smaller chunks compress a little less well, and each dynamic import names its route's set).
Incremental builds (the time compress reports; the process adds about 60 ms), before and
after the incremental cache (results/phase-8-a1.json; both measured in one session):
| build | before | after | target |
|---|---|---|---|
clean (--no-cache) |
3.22 s (3.17 s when first measured) | 3.00 s | not slower than 3.17 s + 5 % ✔ |
| nothing changed | 0.68 s | 0.39 s | — |
one leaf component changed (c299.qx) |
0.76 s | 0.41 s | ≤ 0.5 s ✔ |
the shared header changed (c0.qx) |
0.75 s | 0.41 s | |
the store changed (session.js) |
0.74 s | 0.37 s |
After each of the three edits the incremental dist/ is byte-identical to a clean build's in
another folder, all 2,218 files (compress.mjs --only identity; the shop's test does the same).
Where the time went, measured (a one-file build of 0.76 s): Rolldown's link, render and minify of the 1,106 chunks was about 0.10 s; the JavaScript around it was most of the rest. What changed, all of it algorithm, none of it Rust or a worker:
- Sources are not read when they have not changed: each source's stat (size, mtime, ctime, inode) is kept with its digest, and the compile result is found by the digest (Bazel's digest cache does the same; a file changed in the last 2 s is read again). Opening a file costs 20–60 µs here, a stat 3 µs.
- Fewer hook calls: Rolldown filters the glob, worker,
qatand@qatjs/resumehooks; the facts are read in the load hook; a module's size is found by its compile result's key, without its code. - The chunk plan is reused while the modules' sizes move by less than its margin (the distance of every size-dependent decision from flipping: 203 B on the scale app).
- The trim decision is remembered by the digests of the modules' facts, which are stored as text and parsed only when asked.
- The cache is 16 files and cache.bin: a build writes only the ones it added to, and a build that changed nothing writes nothing.
- Linear passes over the output: the import map's preload sets from bit-set closures (the route
table's 1,000 dynamic imports had sorted 100 names each), one union per distinct combination of
chunk facts in report.json, the commit read from
.gitwithout starting git, a folder's real path once, one stat per written file,report.jsoncopied to the cache instead of written twice.
Not done, with numbers: linking only the changed chunk. Rolldown names a chunk's exports after
everything that imports it, so a link of a subgraph gives other bytes: page p1's subgraph alone
(104 chunks, 21 ms) imports qat.js as {_ as e,a as t,…} where the full build has {S as e,_ as t,…}, and qat.js exports 23 names instead of 28. Rolldown's own experimental.incrementalBuild
lives in one process (watch mode), so it cannot serve a CLI build; even there a rebuild after one
edit took 173–230 ms against 106–117 ms for generating again.
What remains in a one-file build (0.41 s): Rolldown's scan and render, about 0.17 s; compiling the edited component with a cold JIT, about 0.02 s; reading the cache, 0.03 s; importing Rolldown, 0.02 s; the rest under 0.03 s each.
The one miss, and why there is no Rust port
qatjs check first measured 22 s. A CPU profile put 70% of it in TypeScript's checker (relating
JSX attributes to each tag's attribute type), 14% in Qat's compiler, and I/O at noise level — so a
Rust compiler would not have moved it. Two fixes, both in TypeScript:
- each tag's attribute type is one flattened object type instead of an intersection of four (about 17% of the checker's time on JSX-heavy files);
- a project of more than 200 files is type-checked in worker threads, each with a program rooted at its share of the files (TypeScript loads only what they import); the result is the same as a serial check (tested).
Decision (DECISIONS D98): no Rust anywhere in the compiler for v1. Bundling already runs in
Rust (Rolldown); the compiler, check, the language server and the browser playground are
TypeScript. In one line: Rust bundler, TypeScript compiler. Rust stays reserved for a hot spot
that profiling attributes to the compiler itself, ported alone through napi.
Server rendering at scale
The same app rendered on the server (node generate.js --ssr, QAT_MODE=server|island qat compress, node measure-ssr.js). Every page renders the header's 300-component tree (about
330 kB of HTML); /big adds 2,000 rows of route data, and /big/fixed is the remedy
QX-RESUME-LARGE-SEED suggests (100 rows of route data, the rest a stream: 'deferred' load).
/big/async is the same with the load resolving after a timer. /r/… are the same pages
with resume: ['.search']. Node 22, the same laptop; Chrome for resume (median of 3). The table
below is the first run; a later one follows it.
| server | island | target | |
|---|---|---|---|
| server render, typical route (300 routes, p50 / p95) | 13.1 / 26.4 ms | 11.8 / 18.5 ms | p95 < 50 ms |
server render, /big (p50 / p95) |
34.1 / 63.7 ms | 24.1 / 45.3 ms | |
resume, largest route (/p500), one pass, 1× CPU |
64 ms | 83 ms | |
resume, the same with resume: ['.search']: first pass, 1× |
19.5 ms (all resumed: 95 ms) | 17.9 ms (91 ms) | < 100 ms |
resume, /big one pass / /r/big/fixed first pass, 1× |
94 / 25 ms | 89 / 52 ms | |
first interactive element, 4× CPU: /p500 one pass / prioritized |
366 / 177 ms | 363 / 171 ms | |
seeds, largest route by data: /big → /big/fixed |
200 kB → 9.7 kB (190 kB streamed) | the same | ≤ 50 kB |
| memory per request, node adapter, 100 concurrent | ~1.1 MB (peak heap 213 MB, RSS 321 MB; 100 pages in 1.4 s) | ~1.35 MB |
- Met: p95 render (26 ms; island 19 ms); the largest route resumes its listed part in about
20 ms with prioritization; the seed of the largest route is 9.7 kB once the warning's remedy is
applied (
/bigreportsQX-RESUME-LARGE-SEED— "route data #1003 200 kB"). - At 4× CPU the prioritized first pass is 171–177 ms. The hot spot is not resume: the first pass ends only after the route's modules have arrived and run — the page and the header's 300-component module graph — and that is most of it (the one-pass resume of all 300 components adds about 190 ms on top). Splitting the header into a lazy chunk would be the remedy; not done.
- Corrected since: a load still pending when the pass ended but settled before the page is
written is a seed, not a streamed chunk. The server's DOM stays reactive until it is serialized,
so the HTML already shows its value (texts and blocks alike); streaming it made the browser start
on
loading, against the markup it claims, and rebuild it./big/fixed's 190 kB rows settle that early, so they are in its markup and in its seed (the figures above predate this); a load that is still pending when the page is written streams as before. - Island mode runs the same components here (every one has state or handlers: none is pure), so it only differs by noise and its markers.
Seeds with data that arrives later
/big/fixed's deferred load reads rows from memory (Promise.resolve). It is resolved before the
page is written, so it is in the markup and in the seed, and stream: 'deferred' has nothing to
defer. /big/async serves the same rows through a loader that resolves after an await on a timer
(a real macrotask, as a database or network call would). That load is still pending when the page
is written, so it streams. results/phase-8-ssr.json, both modes, the same figures:
| route | seeds (qat/state) |
streamed (qat/data) |
HTML | QX-RESUME-LARGE-SEED |
|---|---|---|---|---|
/big (2,000 rows of route data) |
200,323 B | 0 | 943 kB | fires: "route data #1003 200 kB" |
/big/fixed (100 rows + a load resolved at render) |
200,336 B | 0 | 943 kB | fires: "load #0 191 kB, route data #1004 9.5 kB" |
/big/async (100 rows + a load pending at render) |
9,672 B | 190,661 B | 614 kB | silent |
- The target (≤ 50 kB) is met by
/big/async: 9.7 kB./big/fixedstays at 200 kB. That is a documented limit: a load that is already resolved at render time is seeded, not streamed. The warning adds that limit as a hint when a load is among the largest parts./biggets no hint, since route data is always a seed. QX-RESUME-STRUCTUREis silent for both routes, in server, island and static mode (checked withqatjs checkon the table with an explicitmode). It reports acache: 'user'value the server does not render deciding an{if}/{switch}. Both routes' loads have nocache, so the server renders the{if (more.loading)}branch, as the seed or the stream then confirms. As a control, the same/big/asyncwithcache: 'user', then: 'user'makes it fire ("more(cache: 'user', then: 'user') decides the {if} at 19:12 … on the server route/big/async").- The rest of the run, for comparison with 7b (server / island): typical route p95 23.5 / 18.0 ms;
/big/asyncrender p50 17.1 / 14.9 ms against 28.8 / 24.5 ms for/big/fixed(less HTML to write); first pass at 1× for/big/async109 ms against 147–160 ms for/big/fixed(a smaller seed to parse, fewer rows to claim);/r/p500prioritized first pass at 4× 259 ms; memory per request ~1.1 MB.