From b5bfdf5f4155f94e6d489c19b88c5f8b5fc7df28 Mon Sep 17 00:00:00 2001 From: Nate Moore Date: Wed, 4 Nov 2026 09:13:31 -0500 Subject: [PATCH] Re-measure the cold set after node:test landed Main landed node:test and node:test/reporters (8a3c0df) since this doc was written: the first compat-roadmap addition it expected to push toward the split trigger. Re-measured both trigger conditions with scripts/bench-worker.mjs and an esbuild metafile build of src/runtime/main.ts, after steps 1-2 of the commit sequence. Cold list (doc's list, crypto still excluded) plus node:test: about 154 KB minified, up from ~105 KB pre-node:test, still under the 250 KB trigger. A split-ish stub build of that combined list saves 2.72ms of compile+evaluation and 229 KB of heap per worker in Chromium, versus the second trigger's 8ms/400KB. Trigger not crossed, but both conditions moved toward it. Appended a dated note to the doc with the numbers and the verdict. --- packages/kernel/sketches/lazy-builtins.md | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/packages/kernel/sketches/lazy-builtins.md b/packages/kernel/sketches/lazy-builtins.md index 6eb4890..5193ffa 100644 --- a/packages/kernel/sketches/lazy-builtins.md +++ b/packages/kernel/sketches/lazy-builtins.md @@ -353,3 +353,33 @@ builtinChunk: { args: { id: ChunkId; build: string }; ret: { source: string } }; - **Worker count.** How many runtime workers a realistic session keeps alive (Vite plus its threads, npm script trees). This sets how much 161 KB per worker is worth. It was not measured here. + +## 2026-11-04 re-measure + +Steps 1 and 2 of the commit sequence landed (lazy digest tables; `scripts/bench-worker.mjs` +and the evaluation-budget test). Main also landed node:test and node:test/reporters +(`8a3c0df`), the first compat-roadmap addition this doc expected to push toward the split +trigger. Re-measuring both trigger conditions from the Recommendation: + +- **Cold list size.** An esbuild metafile build of `src/runtime/main.ts` with build.mjs's + runtime options gives each file's minified `bytesInOutput`. The doc's cold list (assert, + readline's cold group, zlib, path-win32, histogram, parse-args, http's module surface; + crypto excluded, still optional) sums to about 94.3 KB today, versus the doc's 105 KB + estimate from a cruder stub-diff — close enough, same shape. node:test's module + (`test.ts`, `test-reporters.ts`, and `test_runner/`'s dozen files) adds about 59.8 KB. + Combined: **~154 KB**, or ~184 KB with crypto. Still under the 250 KB trigger, with less + room than before (was ~105 KB pre-node:test). +- **Per-worker savings.** A stub build with that same combined list (cold list + + node:test) removed as dead-export proxies, same method as the doc's `cold` variant, + minifies to 297,257 B against today's 446,052 B (−148.8 KB, matching the metafile sum). + `scripts/bench-worker.mjs`, 2 interleaved rounds of 9 workers in Chromium, today's + runtime.js versus that stub build: compile 7.81ms → 5.45ms, evaluate 4.45ms → 4.09ms + (combined −2.72ms), heap 1,689 KB → 1,460 KB (−229 KB) median. Under the second + trigger's 8ms compile+evaluate or 400 KB heap. + +**Verdict: the trigger is not crossed.** Both conditions moved toward it (the cold list +grew about 47% from node:test alone; the per-worker heap saving in the split-ish build +grew from the doc's 161 KB estimate to 229 KB with node:test folded in), but neither +threshold is close. repl, the http client, the v8 serializer and sqlite are still ahead of +node:test in the compat roadmap and are not yet in this bundle; the next re-measure after +one or two of them land is the one likely to cross 250 KB. -- knotmirror 0.0.1