Bun's AI-Powered Rust Rewrite Sparks Controversy, Challenges Software Dogma
Bun, the all-in-one JavaScript toolkit recently acquired by Anthropic, has completed a significant and rapid rewrite of its core codebase, transitioning 535,000 lines from Zig to Rust in just 11 days. This ambitious project, reportedly leveraging 64 parallel Claude AI agents and costing an equivalent of $165,000, appears to defy conventional wisdom against full rewrites. The port, resulting in a million lines of Rust, has been lauded for fixing 128 long-standing bugs, reducing binary size by 20%, and delivering performance improvements, silently powering Claude’s code since June. However, this success is not universally celebrated. Andrew Kelly, creator of the Zig language, has publicly dismissed Bun’s claims, asserting the benchmarks are misleading and revealing that the Zig team internally viewed Bun’s previous codebase as an example of poor Zig programming.
The impetus for the rewrite stemmed from critical architectural challenges and strategic shifts. Bun’s original Zig implementation grappled with complex memory management, a hybrid system where half of its objects were handled by JavaScriptCore’s garbage collector and the other half manually in Zig. This led to a codebase prone to memory leaks and bugs, such as a 3MB leak per rebuild in the dev server. Crucially, Anthropic’s acquisition meant future development would increasingly involve Claude AI. Zig’s strict anti-AI stance—refusing LLM-generated pull requests and even closing security reports admitting AI discovery—combined with its nascent stage (pre-1.0, limited training data) made it unsuitable for AI-driven development. Bun’s founder, Jared, opted for Rust to leverage its borrow checker, shifting memory management issues to compile-time errors. The rewrite employed a sophisticated AI-powered workflow: Claude initially created a porting guide after extensive codebase study, then traced struct field lifetimes into a giant spreadsheet. Sixty-four parallel Claude agents then processed 1,448 files across four Git worktrees, achieving a peak output of 1,300 lines of Rust per minute. To maintain code quality, each implementer agent was paired with two adversarial Claude reviewers.
Andrew Kelly’s pointed rebuttal frames the transition as a long-awaited “divorce.” Beyond personal critiques directed at Jared, Kelly raised several technical counter-arguments. He contends that Bun’s reported performance gains largely derive from link-time optimization (LTO), a feature already available in Zig, and that the binary size reduction is unrelated to Rust itself. Kelly also highlighted the omission of compile-time comparisons, suggesting Zig would almost certainly outperform Rust in that regard. This public dispute underscores the divergent philosophies and technical priorities within the low-level language ecosystem, leaving the tech community to weigh the validity of each side’s claims in this unprecedented AI-powered migration.