The most controversial rewrite in history just shipped...

The most controversial rewrite in history just shipped...

July 15, 2026 5 min
📺 Watch Now

🤖 AI Summary

Overview

This episode dives into Bun's ambitious and controversial decision to rewrite its entire codebase from Zig to Rust in just 11 days, leveraging AI tools like Claude. It explores the technical challenges, the motivations behind the rewrite, the outcomes, and the heated reactions from the Zig community, particularly its creator, Andrew Kelly.

Notable Quotes

- Rewriting your codebase is the single worst strategic mistake a software company can make. – Reflecting on Joel Spolsky's famous blog post.

- The Zig team spent years watching Bun embarrass their language with a codebase they privately used as the example of how not to write Zig.Andrew Kelly, on his frustrations with Bun's use of Zig.

- Claude was cranking out 1,300 lines of Rust per minute, paired with adversarial reviewers to keep it honest. – On the AI-driven rewrite process.

🚀 The Rewrite: From Zig to Rust

- Bun rewrote 535,000 lines of code from Zig to Rust in just 11 days, using 64 parallel Claude AI agents.

- The rewrite addressed critical issues with memory management, which had plagued the Zig-based codebase.

- Zig required manual memory management, leading to frequent bugs like memory leaks and double frees.

- Rust's borrow checker moved memory management into the type system, reducing runtime errors.

- The rewrite fixed 128 long-standing bugs, reduced binary size by 20%, and resolved memory leak issues in the dev server.

🤖 AI-Powered Development

- Claude, an AI tool, played a central role in the rewrite:

- It created a porting guide after studying the codebase.

- It traced the lifetime of every struct field into a spreadsheet, documenting years of tribal knowledge.

- AI agents generated Rust code at a rapid pace, with adversarial reviewers ensuring quality.

- The process demonstrated how AI can accelerate large-scale software projects, but also raised questions about the reliability of AI-generated code.

🔥 The Zig Community's Backlash

- Andrew Kelly, Zig's creator, criticized the rewrite and Bun's use of Zig:

- He claimed the performance gains were misleading and attributed them to optimizations Zig already supported.

- He argued that the binary size reduction had little to do with Rust.

- He pointed out that compile times, where Zig excels, were conveniently omitted from the discussion.

- Kelly also took personal jabs at Jared, Bun's founder, accusing him of beginner energy and poor management.

📉 The Challenges of Zig in an AI-Driven World

- Zig's design philosophy is anti-AI, rejecting AI-generated pull requests and security reports.

- Its limited adoption and lack of training data for AI models made it a poor fit for Bun's future, especially after its acquisition by Anthropic, where AI-driven development is central.

- Rust, with its established ecosystem and AI compatibility, became the logical choice for Bun's evolving needs.

⚡ Lessons for Developers

- The episode underscores the risks and rewards of rewriting a codebase, especially with AI.

- It highlights the importance of choosing a programming language that aligns with your project's long-term goals and tooling ecosystem.

- The controversy serves as a reminder of the emotional and technical stakes in the software development community.

AI-generated content may not be accurate or complete and should not be relied upon as a sole source of truth.

📋 Video Description

Try CodeRabbit Review free and turn your next big PR into a guided walkthrough - https://coderabbit.link/fireship

Bun just refactored their entire codebase from Zig to Rust in just 11 days. But not everybody is celebrating...

#coding #programming #ai

Want more Fireship?

🗞️ Newsletter: https://bytes.dev
🧠 Courses: https://fireship.dev