Bun Switches to Rust: Why the Most Popular JS Runtime Abandoned Zig
What Just Happened?
On May 14, 2026, Jarred Sumner โ Bun's creator โ merged PR #30412 with a title that couldn't be more shocking: "Rewrite Bun in Rust".
This isn't a small PR. It's the biggest architectural change Bun has ever made. Bun โ the JavaScript/TypeScript runtime written in Zig since 2022 โ is now officially moving its core to Rust.
The community reaction? 467 upvotes, 547 comments on Hacker News in under 24 hours. People are splitting into two camps: "Rust is the future" vs "Why abandon Zig?"
What Is Bun? Quick Recap
If you're not familiar, Bun is:
- A JavaScript/TypeScript runtime competing directly with Node.js
- Bundler, test runner, package manager โ all in one
- Significantly faster than Node.js in many benchmarks
- Originally written in Zig โ a systems programming language focused on performance
Bun chose Zig because it offers manual memory control, fast compilation, and no garbage collector. Ideal for a runtime that needs raw speed.
So why switch?
Why Abandon Zig for Rust?
According to Jarred Sumner's PR description, the main reason isn't "Rust is faster than Zig" โ it's the tooling for catching bugs.
1. Memory Safety โ Bun's Biggest Problem
Bun has hit numerous memory bugs throughout its development:
- Buffer overflows
- Use-after-free errors
- Memory leaks
- Dangling pointers
Zig has safety checks, but they're optional and not comprehensive. Rust is different โ the compiler forces you to handle memory safety at compile time. There's no way around it unless you use unsafe.
This is the biggest reason: the Bun team spent too much time debugging memory bugs. Rust eliminates most of these problems upfront.
2. Smaller Binary Size
The PR reports binary size shrinking by 3-8MB. For a runtime distributed via npm/bun install, every MB matters. Smaller binary = faster downloads, faster CI/CD.
3. Neutral to Faster Benchmarks
No performance regression. Benchmarks range from "neutral" to "faster." You lose nothing by switching โ you only gain.
4. Architecture Stays the Same
Here's the interesting part: Bun isn't rewriting its architecture. Same architecture, same data structures, few third-party libraries, and notably โ no async Rust.
This is crucial. They're not starting from scratch. They're porting code from Zig to Rust, keeping the same logic, just changing how memory is managed.
What Is the Community Saying?
Supporters
General sentiment: "Zig is great but the ecosystem is too small. Rust has tooling, crates, and a massive community. Bun team will ship faster with Rust."
One developer on HN commented: "Bun spent 2 years fighting memory bugs. If Rust solves that problem, why not?"
Opponents
The Zig community isn't happy. Their arguments:
- Zig is evolving fast and will have better tooling soon
- Rust is too complex for a project that needs to iterate quickly
- Bun is abandoning the language it helped popularize
One notable comment: "Bun was the flagship project of Zig. Now abandoning it โ what signal does that send to the Zig community?"
Assessment
This is the right call. Here's why:
-
Practical > Pure: Bun is a commercial product (backed by oven.sh). They need to ship features fast, fix bugs fast. Rust's compiler catching errors at compile time = less debugging = faster shipping.
-
Ecosystem matters: Rust has 150,000+ crates on crates.io. Zig has about 3,000. When you need to integrate libraries, Rust clearly has the advantage.
-
Memory safety is the trend: Android, Linux kernel, Windows โ all are adopting Rust for memory-critical code. Bun following this trend makes sense.
-
Not a rewrite from scratch: They're keeping the architecture. This isn't "let's start over" โ it's "let's port to a safer language." Very different.
What Does This Mean for Developers?
If You Use Bun
- Minimal impact โ Bun's API isn't changing, still Node.js compatible
- Smaller binary size = faster installation
- Fewer memory bugs = more stable in production
- Try it now:
bun upgrade --canary
If You're Learning Zig
This is a signal worth considering. Zig is still great, but its ecosystem is shrinking relative to Rust. If your goal is a career in systems programming, Rust is the safer bet (in both senses of the word).
If You Use Node.js/Deno
The competition between JS runtimes is heating up. Bun with a Rust core will:
- Potentially iterate faster thanks to better tooling
- Attract more contributors who know Rust (broader pool than Zig)
- Push Node.js and Deno to improve performance
Quick Comparison: Zig vs Rust for Runtimes
| Zig | Rust | |
|---|---|---|
| Memory safety | Optional checks | Compile-time guarantee |
| Ecosystem | ~3K packages | ~150K crates |
| Compile speed | Very fast | Slower (but improving) |
| Learning curve | Medium | High |
| Community | Small, growing | Large, mature |
| Tooling | Developing | Excellent (clippy, rust-analyzer) |
Conclusion
Bun switching to Rust isn't because Zig is bad โ it's because Rust solves exactly the problems Bun was facing. Memory safety, ecosystem, tooling โ all favor Rust for a project at Bun's scale.
This is also a lesson for every developer: choose languages based on specific problems, not hype. Bun used Zig when it fit, switched to Rust when needed. There's no "best language" โ only the "best fit" for each stage.
Is Bun right to abandon Zig?
References: