On July 8, 2026, Bun shipped v1.4.0 — the first version of the JavaScript and TypeScript runtime written in Rust. v1.3.14 was the last Zig release. Since Anthropic acquired Bun in December 2025, founder Jarred Sumner has not gone for incremental polish: this was a full move of the runtime from Zig to Rust, and almost none of it was rewritten by hand. Claude Code’s dynamic workflows, paired with a pre-release Claude Fable 5, did the porting with up to 64 concurrent agents over eleven days. Sumner watched the whole run — but the ones typing were mostly agents.
Why Zig Had to Go
The motivation was concrete. v1.3.14 shipped with a trail of memory-management bugs: use-after-free, double-free, and leaks scattered across node:zlib, node:http2, UDPSocket, Buffer, crypto.scrypt, fs.watch, the CSS parser, and MessageEvent. Sumner traced the root cause to coexisting garbage-collected JavaScriptCore values and manually managed memory. Zig demands explicit cleanup at every call site; miss one and you get a leak or a double free. The codebase was 535,496 lines of Zig excluding comments. He considered C++, but that just hands the problem to code review. His verdict fits in one line: “Compiler errors are a better feedback loop than a style guide.” In safe Rust, these bug classes become compile failures, and cleanup happens automatically. He still credits the old partner: “Zig made Bun possible. I would never have been able to build this much in 1 year if it wasn’t for Zig.”
Eleven Days, Sixty-Four Concurrent Agents
The timeline alone reads like a stress test: work started May 3, the branch merged May 14 — eleven days, roughly 50 workflow loops. At peak, 64 Claudes were on the clock: 4 workflows x 16 agents each, spread across 4 git worktrees. 1,448 .zig files became .rs files, and roughly 16,000 compiler errors were divvied up among the agents. Peak output hit about 1,300 lines per minute; the busiest hour landed 695 commits, on the way to 6,502 total and a final diff of more than a million lines. Order was kept by two documents: a porting guide defining the mechanical rules, and a lookup table recording the lifetime of every struct field. Sumner wasn’t sure it would work at first; after several days and a high percentage of tests passing, he merged the whole thing.
Tests and Adversarial Review Held the Line
Quality control ran on three layers. The first was tests: zero tests skipped or deleted, with around 1.39 million assertions across 4,174 test files preserved on Debian — a suite written in TypeScript that doubled as a language-independent conformance harness the agents could verify against, over and over. The second was adversarial review: one agent implements, at least two more attack the work from separate context windows where they see only the diff, and reviewers were explicitly told to reject long justifying comments — “if a workaround needs a paragraph, the code is wrong — fix the code.” The third was aftercare: all 19 regressions introduced during the port were fixed, about 4% of the Rust sits in unsafe blocks, and the team followed up with 11 rounds of security review and fuzzing that ran the parsers on the order of a hundred billion executions.
Performance, Memory, and Production Status
The result is not the old “rewrite gets slower” story — it’s a small uplift almost everywhere:
- Bun.serve went from 169.6k to 177.7k requests per second (+4.8%)
next builddropped from 13.62s to 13.03s (+4.5%), tsc got 4.7% faster- 2,000 in-process builds: memory fell from 6,745 MB to 609 MB — v1.3.14 leaked roughly 3 MB per build
- Binaries shrank about 20%: Windows from 94 to 76 MB, Linux from 88 to 70 MB
- 128 bugs that reproduce in v1.3.14 were fixed along the way
The bill is just as concrete: 5.9 billion uncached input tokens, 690 million output tokens, and 72 billion cached reads — roughly $165,000 at API pricing, which Sumner estimates would otherwise be three engineers for a year. It is already quietly in production: Prisma’s compute service runs its public beta on it, and Claude Code switched at v2.1.181, with 10% faster Linux startup and, per Sumner, “barely anyone noticed.” His take: “Boring is good.”
Lessons for the Agent Era
Simon Willison’s commentary puts the event in a longer arc: Joel Spolsky’s 2000 edict “never rewrite from scratch” has met its first credible exception, in the form of frontier coding agents plus a million-assertion conformance suite. Three lessons stand out for engineering teams. Put constraints in the compiler and the test suite, not the style guide. Keep reviewers in isolated contexts where they see only the diff, so the implementer’s narrative can’t carry them along. And when a port drops from person-years to eleven days plus one API invoice, the decision framework for language and platform migrations has genuinely new variables. As Sumner puts it: “One engineer can do a lot more today than a year ago.”
Sources
AI-assisted summary compiled from the sources above, reviewed by a human before publishing.
