SnapSummary logo SnapSummary Try it free →
The most controversial rewrite in history just shipped...
Fireship · Watch on YouTube · Generated with SnapSummary · 2026-07-15

Bun’s Zig-to-Rust Rewrite

What happened

  • Bun, an all-in-one JavaScript toolkit later acquired by Anthropic, rewrote its roughly 535,000 lines of Zig code in Rust using 64 parallel Claude agents.
  • The project took 11 days, involved 1,448 files and 6,502 commits, and was estimated to cost $165,000 in AI usage.
  • Bun’s test suite passed across platforms after the rewrite.

Why Bun switched

  • Bun’s Zig code had complicated memory ownership: some objects belonged to JavaScriptCore’s garbage collector, while others were managed manually.
  • This led to bugs such as use-after-free, double-free, and memory leaks. One dev-server error path leaked 3 MB per rebuild.
  • Bun also expected Claude to write much of its future code. Zig’s limited training data, ongoing breaking changes, and opposition to AI-generated contributions made it a poor fit for that plan.
  • Rust’s borrow checker was expected to catch many memory-management errors at compile time.

How the port was done

  1. Claude studied the codebase and produced a porting guide.
  2. The team documented the lifetimes of struct fields in a large spreadsheet.
  3. 64 agents translated code across four Git worktrees.
  4. Each implementation was checked by two separate Claude agents instructed to look for flaws.

Reported results and debate

  • Bun says the rewrite fixed 128 longstanding bugs, resolved memory-leak issues, reduced binary size by 20%, and improved performance by a few percent.
  • Zig creator Andrew Kelly disputed how those results were presented:
  • He argued performance gains may mainly reflect link-time optimization, which Zig also supports.
  • He said binary-size reductions weren’t necessarily due to Rust and noted Bun did not report compile times, where Zig may be faster.
  • Kelly also criticized Bun’s code quality and founder Jared Friedman, mixing technical arguments with personal attacks.

Bottom line

The rewrite appears to have delivered practical benefits for Bun, especially around memory safety and compatibility with AI-assisted development. But the video notes that the performance and binary-size claims are contested, and that neither side clearly “wins” the public dispute.

Sponsor mention

The video also promotes CodeRabbit, a tool that organizes pull-request reviews into guided walkthroughs, summarizes changes, and can generate diagrams.

📬 Never miss a Fireship video — every new upload summarized in your inbox. Follow free

Summarize any YouTube video instantly

Get AI-powered summaries, timestamps, and Q&A for free.

Generate your own summary →
More summaries →