{"slug": "bun-rust-vs-zig-who-gets-it-right-according-to-ai", "title": "Bun (rust) vs Zig: Who Gets It Right, According to AI", "summary": "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.", "body_md": "# Bun (rust) vs Zig: Who Gets It Right, According to AI\n\n### The Bun Zig-to-Rust Rewrite: Jarred Sumner vs Andrew Kelley\n\nIn 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.\n\nThe 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.\n\nAndrew 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.\n\n## Jarred Sumner's Side\n\nSumner 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.\n\nBut Bun sits between two worlds. JavaScriptCore is a garbage-collected engine. The native code manages memory by hand. That mix caused constant problems.\n\n\"Every memory allocation has to be meticulously reviewed. Where do these bytes get freed? How do we ensure it only gets freed once?\"\n\nThe 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.\n\nSumner's argument was simple. Zig uses explicit `defer`\n\nat every call site. You have to remember to write cleanup code each time. Rust uses `Drop`\n\n. It runs automatically when a value goes out of scope. The compiler enforces it.\n\nZig uses `defer`\n\nand `errdefer`\n\nmanually. C++ uses destructors and RAII. Rust uses `Drop`\n\nautomatically and guarantees it runs.\n\n### How the Port Worked\n\nSumner 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.\n\nAt 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.\n\n### What Changed\n\n128 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.\n\nSumner 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.\n\n## Andrew Kelley's Side\n\nKelley leads the Zig Software Foundation. His response was less about technology and more about a failed relationship.\n\n\"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.\"\n\n### Slop Before AI\n\nKelley's strongest claim was that Sumner wrote bad code long before LLMs existed.\n\n\"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.\"\n\nFor 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.\n\n### The False Choice\n\nKelley 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.\n\n\"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.\"\n\nTigerBeetle is a financial database written in Zig. It proves Zig can produce stable software when the team priorities quality.\n\n### The Test Problem\n\nKelley'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?\n\nThe 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.\n\n### Performance Claims\n\nKelley 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.\n\n### The Real Story\n\nKelley described a deteriorating relationship. Sumner had a reputation as a bad manager. Poor communication, unrealistic expectations, low empathy. Former employees and interviewees confirmed it.\n\nBun 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.\n\nWhen 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.\n\n\"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'.\"\n\nKelley 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.\n\n## Community Reaction\n\nOn 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.\n\n### X/Twitter\n\nTheo (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.\n\n## Who Was Right?\n\n### What Jarred Got Right\n\nRust 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.\n\nThe 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.\n\nAI-assisted large-scale refactoring is viable. 165,000ischeapcomparedtoayearofthreeengineersmaking165,000*ischeapcomparedtoayearofthreeengineersmaking*750,000 to $1.5 million total.\n\n### What Andrew Got Right\n\nThe root cause was never Zig. Sumner admitted other Zig users don't have the same bugs. Engineering culture matters more than language choice.\n\nThe blog post mixed up unrelated improvements. Binary size reduction, comptime optimization, and LTO are all possible in Zig. Attributing them to Rust is marketing.\n\nA 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?\n\nThe relationship breakdown was real and relevant. This was never a clean technical debate. It was personal.\n\n### The Verdict\n\nTechnically, Jarred won. The rewrite works. The metrics are public and clear. Rust is better for Bun's needs.\n\nCulturally, 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.\n\nArchitecturally, nobody won. The real news is that LLMs make large rewrites economically possible. Whether that is good or bad depends on your risk tolerance.\n\n## Bigger Questions\n\nCan AI-generated code be trusted at scale? The adversarial review pipeline is one answer. It is not proven over years of maintenance.\n\nWhat 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?\n\nDo language safety guarantees matter more than engineering culture? Both do. But Rust's guarantees fit a team that struggled with manual memory management.\n\nIs Zig's design philosophy a liability for large projects? Not inherently. TigerBeetle proves that. But it requires discipline that Bun did not have.\n\n## Timeline\n\nApril 2021: Sumner writes his first Zig code for Bun.\n\n2021 to 2024: Bun grows to 22 million monthly downloads in Zig.\n\n2022 to 2024: The relationship between Kelley and Sumner gets worse.\n\nDecember 2025: Anthropic acquires Bun.\n\nMay 3 to 14, 2026: The 11-day Rust rewrite happens.\n\nMay 2026: The rewrite is merged. 99.8% of tests pass.\n\nJuly 8, 2026: Sumner publishes \"Rewriting Bun in Rust.\"\n\nJuly 9, 2026: Kelley publishes his response. He updates it later.\n\nJuly 14, 2026: The Register covers the story.\n\nJuly 15, 2026: Linus Torvalds weighs in on the AI debate.", "url": "https://wpnews.pro/news/bun-rust-vs-zig-who-gets-it-right-according-to-ai", "canonical_source": "https://grigio.org/bun-rust-vs-zig-who-gets-it-right-according-to-ai/", "published_at": "2026-07-16 11:05:54+00:00", "updated_at": "2026-07-16 11:29:38.984612+00:00", "lang": "en", "topics": ["developer-tools", "ai-agents", "ai-tools"], "entities": ["Jarred Sumner", "Andrew Kelley", "Bun", "Zig", "Rust", "Claude Code", "Anthropic"], "alternates": {"html": "https://wpnews.pro/news/bun-rust-vs-zig-who-gets-it-right-according-to-ai", "markdown": "https://wpnews.pro/news/bun-rust-vs-zig-who-gets-it-right-according-to-ai.md", "text": "https://wpnews.pro/news/bun-rust-vs-zig-who-gets-it-right-according-to-ai.txt", "jsonld": "https://wpnews.pro/news/bun-rust-vs-zig-who-gets-it-right-according-to-ai.jsonld"}}