Why an ahead-of-time compiler beats a Rust rewrite
Just after rewriting Bun from Zig into Rust over the summer, Jarred Sumner asked whether to rewrite Claude Code in Rust to slash its memory footprint and startup latency. Roughly half the CPU budget in a typical JavaScript app goes to JIT compilation on the fly:
“For a typical JavaScript-based application. Roughly half of like the CPU time is just spent compiling code on demand.”00:02:15
Bun’s own Rust rewrite succeeded because Bun’s test suite is written in TypeScript—independent of the runtime language. Claude Code’s tests, by contrast, live in the same TypeScript codebase; porting them breaks the oracle:
“As soon as you're like rewriting the tests. Then you can't really trust the test anymore. So that seems like it'd be too risky.”00:03:28
Compiling JavaScript ahead of time with bun compile solved the bottleneck without abandoning TypeScript—cutting memory ~4×, doubling startup speed, and beating single-threaded typescript-go:
“It uses about four x less memory.”00:04:37
2026-11-12T1407). The reading: contrast with Lovable’s Rust rewrite of the Vite dev server—when your test suite is coupled to the app language, accelerating the runtime keeps your verification truth intact.Evidence: transcript 00:02:15, 00:03:28, 00:04:37
Design for testability before writing compiler code
Shipping millions of lines of agent-authored compiler code starts with deciding how you will ever trust it:
“You're really constrained by how you test that the code works. So that's like even more important than what you're specifically like the approach you go with for how to build it.”00:01:51
Sumner’s compiler treats TypeScript annotations as hints rather than sound invariants—emitting fast field accesses when monomorphic and checking types dynamically otherwise:
“Types are don't necessarily need to be correct. So it treats types as predictions instead of, like, trusting them.”00:05:56
That choice unlocked three-way differential testing—JIT vs. typed AOT vs. untyped AOT—layered atop Bun’s existing suite, WebKit tests, test262, and Fuzzilli extended for TypeScript type predictions:
“We can largely trust that the tests that predate the project worked.”00:06:26
2026-11-12T1409). The reading: pre-existing test suites and differential invariants give agents an un-gameable guardrail—never let the same model that writes the feature invent the only tests checking it.Evidence: transcript 00:01:51, 00:05:56, 00:06:26
Batches, continuous agents, and one build per wave
Compiler work splits into three operational rhythms: large structured batches when generating major subsystems, long-running continuous agents iterating on bugs and speed, and an hourly scorecard tracking the numbers. During big-batch generation, compiling after every small change stalls everything:
“When you're in the big batch kind of project stage, then. You don't want to run builds. You want to run one build because otherwise you're going to spend all your time compiling”00:08:28
Evidence: transcript 00:08:28
Five compilers in 46 days
Because the compiler had not shipped externally yet, restarting from scratch beat nursing broken architecture. Compiler #1 leaked gigabytes; #2 made brittle guesses like assuming any .archive property meant Bun.archive; #3 skipped 1,500-file markdown docs and used 140 parallel agents to get Claude Code running:
“140 agents at the same time write all the code all the same time, then get cloud code to run.”00:09:43
Compiler #4 produced clean code but took 50 seconds to build Claude Code—and 10–20 seconds even on ordinary apps—while ballooning toward 900,000 lines:
“Because in older versions of this compiler, it was taking like ten to twenty seconds.”00:09:43
“Part of it was also like, why is it nine hundred thousand lines of code? This should be a lot like smaller. So, let me do it one more time.”00:09:43
Rewrite #5 cut the sprawl and dropped compile times under 20 seconds, making it shippable.
Evidence: transcript 00:00:53, 00:09:43
Long-lived subagents and an hourly Slack scorecard
For the summer Rust rewrite, Sumner wired classic multi-stage workflows—handing off between separate research, planning, writing, review, and benchmark agents. On newer models, he replaced those step pipelines with long-lived subagents owning one idea across days:
“I mostly just rely on subagents that are like very long lived. Except for that initial part where you're like writing all the code all at once. And this, with the subagents, it works pretty well because. They keep all the context of the relevant code in their head, or like in the context window.”00:14:51
To keep visibility across days of autonomous runs without hovering over terminals, an hourly loop posted the same metrics card to Slack comparing current numbers against the prior run and the JIT baseline:
“I think a lot on like, just having an hourly update, and where we post this work card. Comparing a bunch of metrics that we were prioritizing.”00:16:07
2026-11-12T1423). The reading: paired with Ramp’s Slack-native threads, an automated hourly scorecard keeps humans calibrated on trajectory drift without interrupting long-running sessions.Evidence: transcript 00:14:51, 00:16:07
What you actually do all day: demand ambition
Models naturally underestimate what is possible, talk themselves into conservative rules, and settle for tiny wins. Sumner’s day-to-day steering consisted of sharp leading questions—“why are we doing this?”, “what’s taking so long?”, and telling Claude it wasn’t believing in itself enough—driving JetStream 3 past V8 and Node while bun compile compiled itself:
“Because it kind of like talks itself into making up rules. And also, it tends to not be. It tends to like. Underestimate what it can do. So I often end up saying things like this to get it to like. Try harder.”00:18:48
“And if you act ambitiously, then the models will like. Start having like zero point one percent improvements instead of like ten percent improvements.”00:20:35
Even with self-hosting benchmarks winning, keep checking the verifier itself—especially when fuzzers or tests quietly miss edge cases like prototype-pollution guards or eval-heavy code:
“And to make sure that the tests actually test things.”00:20:35
- Protect your test oracle first: keep TypeScript tests intact with AOT compilation instead of rewriting tests into Rust; anchor on pre-existing suites and differential runs (
00:01:51,00:03:28,00:06:26). - Reset fast and keep subagents long-lived: batch initial builds once, throw away bloated pre-shipped attempts early, and let long-lived subagents own ideas for days (
00:08:28,00:09:43,00:14:51). - Watch an hourly scorecard and demand ambition: surface regressions in Slack every hour and push models past 0.1% tweaks toward 10% gains (
00:16:07,00:18:48,00:20:35).
- Bun Ahead-of-time compilation — Experimental
bun compiledocs. - Rewriting Bun in Rust & Bun is joining Anthropic — Background on TypeScript-independent tests and Claude Code memory constraints.
- googleprojectzero/fuzzilli & tc39/test262 — Pre-existing conformance and fuzzing harnesses.
- Walden Yan: 40× the work on 2.7× the people — Companion mainstage talk on “ambition is the limit” and long-running agents.
Evidence: transcript 00:17:36, 00:18:48, 00:20:35