cd /news/developer-tools/bun-rust-vs-zig-who-gets-it-right-ac… · home topics developer-tools article
[ARTICLE · art-61933] src=grigio.org ↗ pub= topic=developer-tools verified=true sentiment=· neutral

Bun (rust) vs Zig: Who Gets It Right, According to AI

Jarred Sumner rewrote Bun from Zig to Rust in 11 days using 64 AI agents, fixing 128 bugs and improving performance, while Zig creator Andrew Kelley criticized the project's code quality and diverging values.

read8 min views2 publishedJul 16, 2026
Bun (rust) vs Zig: Who Gets It Right, According to AI
Image: Grigio (auto-discovered)

The Bun Zig-to-Rust Rewrite: Jarred Sumner vs Andrew Kelley

In May 2026, Jarred Sumner rewrote Bun from Zig to Rust in 11 days. He used 64 Claude Fable 5 agents running in parallel through Claude Code. The cost was about $165,000 at API pricing. Bun was 535,496 lines of Zig.

The rewrite passed 99.8% of Bun's test suite. It made the binary 20% smaller. HTTP throughput went up 2 to 5 percent. And it fixed 128 bugs that existed in the Zig version. Bun v1.3.14 was the last Zig release. Bun v1.4.0 ships in Rust.

Andrew Kelley, the creator of Zig, did not hold back. His response laid out a years-long breakdown between the two projects. The debate spread across Reddit, X/Twitter, and Hacker News.

Jarred Sumner's Side #

Sumner started Bun in April 2021 as a port of esbuild from Go to Zig. He picked Zig for its simplicity and low-level control. He built a whole JavaScript runtime, bundler, package manager, and test runner in one year. By himself. In a small Oakland apartment. Before LLMs existed.

But Bun sits between two worlds. JavaScriptCore is a garbage-collected engine. The native code manages memory by hand. That mix caused constant problems.

"Every memory allocation has to be meticulously reviewed. Where do these bytes get freed? How do we ensure it only gets freed once?"

The Zig version had use-after-free crashes in node:zlib, node:http2, and UDPSocket. It had memory leaks in crypto.scrypt, tlsSocket.setSession, and fs.watch. It had double-free crashes in the CSS parser. The list went on.

Sumner's argument was simple. Zig uses explicit defer

at every call site. You have to remember to write cleanup code each time. Rust uses Drop

. It runs automatically when a value goes out of scope. The compiler enforces it.

Zig uses defer

and errdefer

manually. C++ uses destructors and RAII. Rust uses Drop

automatically and guarantees it runs.

How the Port Worked

Sumner did not try to write idiomatic Rust. He mapped Zig patterns to equivalent Rust patterns in a porting guide. He traced every struct field's lifetime across the whole codebase. Then he used adversarial review. Separate Claude instances checked the work of the implementer. Their only job was to find bugs.

At peak, the system wrote about 1,300 lines of code per minute across 64 parallel Claudes. Nothing was merged without adversarial review. No tests were skipped or deleted.

What Changed

128 bugs fixed that exist in the Zig version. Binary size dropped 20% (70 MB on Linux, 76 MB on Windows). HTTP throughput went up 2 to 5 percent for Bun.serve, node:http, Elysia, Express, and Fastify. Memory leaks were eliminated. A Bun.build loop that leaked 3 MB per iteration now stays around 600 MB. Stack space shrank. Claude Code started 10% faster.

Sumner said it plainly: "Zig made Bun possible. I would never have been able to build this much in 1 year if it was not for Zig." But for a mature project serving 22 million monthly downloads, Rust offered better tools for stability.

Andrew Kelley's Side #

Kelley leads the Zig Software Foundation. His response was less about technology and more about a failed relationship.

"The main issue here had nothing to do with the language features of Zig vs Rust, and everything to do with the diverging value systems of the two projects."

Slop Before AI

Kelley's strongest claim was that Sumner wrote bad code long before LLMs existed.

"We became increasingly horrified at the programming practices we saw in Bun's codebase. Hacks on top of hacks. Abuse of assertions. Jarred was already writing slop well before he had access to LLMs."

For Kelley, Bun was a liability. The most visible Zig project in the world was also the worst example of how not to write Zig. Community members were tired of being associated with Bun's stability problems.

The False Choice

Kelley pointed out a trick in Sumner's post. It frames the choice as picking a style guide (Zig) or a language feature (Rust's Drop) to prevent bugs.

"The sleight of hand misdirects the reader away from the main way bugs are eliminated: by dedicating engineering resources to it. You are not giving TigerBeetle nearly enough credit. They put in the time to find and eliminate bugs."

TigerBeetle is a financial database written in Zig. It proves Zig can produce stable software when the team priorities quality.

The Test Problem

Kelley's sharpest question: if the test suite is good enough to validate a million lines of AI-generated Rust, why was it not catching all the bugs in Zig?

The counterargument is that Rust prevents entire classes of bugs by construction. The same tests that detected bugs in Zig can validate they don't exist in Rust. The language eliminates them at compile time.

Performance Claims

Kelley noted that the claimed improvements were not because of Rust. Zig has supported link-time optimization for years. Sumner could have enabled it. The work to reduce comptime abuse could have been done in the Zig codebase. Kelley said they warned Sumner about it for years. And compilation speed was conveniently left out of the blog post. Zig's incremental compilation is much faster than Rust's.

The Real Story

Kelley described a deteriorating relationship. Sumner had a reputation as a bad manager. Poor communication, unrealistic expectations, low empathy. Former employees and interviewees confirmed it.

Bun maintained a fork of Zig that it claimed compiled 4x faster. The Zig team refused to merge it. They had a policy against accepting AI-generated contributions. LLM-generated slop was already flooding the project.

When Anthropic bought Bun, the Zig team breathed a sigh of relief. The $60,000 yearly donation stopped. Nobody was surprised. The relationship was already dead.

"When Jarred announced the Rust rewrite, we were ecstatic. Now I am sipping tea from a mug that says 'It Tastes Like It is Not My Problem Anymore'."

Kelley later updated his post. He admitted his original framing was clouded by resentment. He apologized to Zig users who might worry about being treated the same way.

Community Reaction #

On r/rust, the post hit 701 points and 388 comments. The sentiment was pro-Rust but mixed on Kelley's tone. On r/Zig, 518 points and 171 comments. The community was defensive of Kelley and critical of Bun. On r/programming, 575 points and 291 comments. People focused on the technical merits of the rewrite. On r/bun, 162 points. The community was split between enthusiasm and skepticism. On r/BetterOffline, 132 points. People sympathized with Kelley.

X/Twitter

Theo (t3.gg) was fiercely critical of Kelley. He called it the most pissed off he has ever been on camera. Mitchell Hashimoto praised the efficiency. He said no engineer at that salary could match what Claude did in 11 days. Linus Torvalds told AI haters to fork off, which added weight to the pro-AI side. Zach Vorhies said Zig lacks constructors and destructors and that AI-generated Rust is higher quality than carefully written Zig.

Who Was Right? #

What Jarred Got Right

Rust offers better tools for Bun's specific problem. A project mixing garbage collection and manual memory benefits from Drop, borrow checking, and Miri. The numbers back this up. 128 bugs fixed. Memory leaks gone. Production stability improved.

The rewrite met its goals. Test suite passed. Performance stayed the same or got better. Binary size went down. Team productivity was maintained. By any measure, it worked.

AI-assisted large-scale refactoring is viable. 165,000ischeapcomparedtoayearofthreeengineersmaking165,000ischeapcomparedtoayearofthreeengineersmaking750,000 to $1.5 million total.

What Andrew Got Right

The root cause was never Zig. Sumner admitted other Zig users don't have the same bugs. Engineering culture matters more than language choice.

The blog post mixed up unrelated improvements. Binary size reduction, comptime optimization, and LTO are all possible in Zig. Attributing them to Rust is marketing.

A million lines of AI code with no human review is new territory. The adversarial review system is clever, but AI review is not human judgment. Nineteen regressions were found and fixed. What has not been found yet?

The relationship breakdown was real and relevant. This was never a clean technical debate. It was personal.

The Verdict

Technically, Jarred won. The rewrite works. The metrics are public and clear. Rust is better for Bun's needs.

Culturally, Andrew won. The rewrite was not a judgment on Zig. It was a judgment on Bun's engineering culture. A culture Kelley warned about for years.

Architecturally, nobody won. The real news is that LLMs make large rewrites economically possible. Whether that is good or bad depends on your risk tolerance.

Bigger Questions #

Can AI-generated code be trusted at scale? The adversarial review pipeline is one answer. It is not proven over years of maintenance.

What is the role of human code review? If AI can review AI code to pass a million-assertion test suite, is human review a luxury or a necessity?

Do language safety guarantees matter more than engineering culture? Both do. But Rust's guarantees fit a team that struggled with manual memory management.

Is Zig's design philosophy a liability for large projects? Not inherently. TigerBeetle proves that. But it requires discipline that Bun did not have.

Timeline #

April 2021: Sumner writes his first Zig code for Bun.

2021 to 2024: Bun grows to 22 million monthly downloads in Zig.

2022 to 2024: The relationship between Kelley and Sumner gets worse.

December 2025: Anthropic acquires Bun.

May 3 to 14, 2026: The 11-day Rust rewrite happens.

May 2026: The rewrite is merged. 99.8% of tests pass.

July 8, 2026: Sumner publishes "Rewriting Bun in Rust."

July 9, 2026: Kelley publishes his response. He updates it later.

July 14, 2026: The Register covers the story.

July 15, 2026: Linus Torvalds weighs in on the AI debate.

── more in #developer-tools 4 stories · sorted by recency
── more on @jarred sumner 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/bun-rust-vs-zig-who-…] indexed:0 read:8min 2026-07-16 ·