Roc rewrites 300K lines of Rust to Zig, hits feature parity
Key Takeaways
- Roc's compiler reached feature parity after rewriting 300,000 lines from Rust to Zig over 487 days
- The new Zig compiler produces binaries half the size of the original Rust version
- Hot code loading now works automatically during development, a feature rare in compiled languages
The Roc programming language team has hit a major milestone: their Rust-to-Zig rewrite now matches the original compiler's feature set. After 487 days and 300,000 lines of code, the new Zig-based compiler can build everything the Rust version could, with some notable improvements. The timing is striking. While most projects are migrating toward Rust, Roc moved the opposite direction.
Richard Feldman, Roc's creator, shared the update in a detailed post. "We recently passed an exciting milestone: feature parity with the original compiler," he wrote. The team proved it works by updating Rocci Bird, a WASM-4 game, to compile on the new system. The result: a 31KB WebAssembly binary, less than half the size the Rust compiler produced.
Why rewrite from Rust to Zig?
This wasn't a simple port. The team had accumulated enough design decisions they wanted to change that a clean rewrite made more sense than incremental refactoring. Feldman explicitly noted that techniques Bun used for their recent Zig-to-Rust port wouldn't have worked here. The Roc team needed to rethink core architecture, not just translate syntax.
Zig's appeal for compiler work comes down to control. The language gives explicit control over memory allocation without hidden control flow. For a compiler, that predictability matters. Rust's ownership model and borrow checker, while excellent for application code, can fight against the patterns compiler developers often need.
The 487-day timeline stands in sharp contrast to Bun's 11-day Zig-to-Rust port. But the comparison isn't fair. Bun did a direct translation of roughly 500,000 lines. Roc rewrote with fundamental changes to the parser, type-checker, and lambda set resolution system. Different goals, different timelines.
Hot code loading: a compiled language acting interpreted
The new compiler enables hot code loading during development. Run a web server with roc server.roc, edit the code while it runs, and the next request uses the updated logic. No restart required. This behavior is standard in Python or JavaScript. In a compiled language targeting high performance, it's unusual.
For founders building products, this changes the development loop significantly. The edit-compile-restart cycle disappears for iteration. You keep the performance of compiled code with the workflow of interpreted languages.
Smaller binaries, browser-ready compiler
Binary size dropped substantially. The Rocci Bird game went from over 62KB to 31KB. That's a direct result of the new compiler architecture, not just language choice.
The team also shipped a browser-hosted compiler. The Roc homepage now runs an "echo" platform via a 2.5MB WebAssembly binary. Anyone can write and execute basic Roc programs without installing anything. For language adoption, removing installation friction matters enormously.
The contributors who made it happen
Feldman credited specific contributors for major subsystems. Anthony Bullard and Sam Mohr built the new parser. Jared Ramirez created the type-checker. Ayaz Hafiz designed the new lambda set resolution system. The original Rust compiler's foundation came from Folkert de Vries, Brendan Hansknecht, Brian Carroll, and others.
Two names stood out: Anton-4 and Luke Boswell. Feldman wrote that enumerating their contributions "could take up a whole second post." For an open source project, that depth of committed contributors signals a healthy community.
Sponsors also got acknowledgment: rwx, Lambda Class, ohne-makler, martian, tweede golf, Vendr, NoRedInk, plus individual backers. Open source projects with both corporate and individual sponsors tend to sustain development longer than those relying on one funding source.
What this means for the Rust vs Zig debate
Two serious projects moved in opposite directions within months of each other. Bun shifted from Zig to Rust. Roc shifted from Rust to Zig. Neither team is wrong. They're optimizing for different constraints.
Bun prioritized Rust's mature ecosystem and tooling for their JavaScript runtime. Roc prioritized Zig's explicit memory control and simpler compilation model for their language compiler. The takeaway isn't that one language wins. It's that the choice depends heavily on what you're building.
Logicity's Take
For startup founders considering Zig or Rust for systems work, Roc's experience suggests Zig earns its place when you need granular memory control and predictable compilation. Rust remains stronger for applications where the borrow checker catches bugs that would otherwise reach production. If you're building developer tools or compilers, the Roc case study is worth studying. If you're building application infrastructure, Bun's opposite conclusion matters too. Neither language is universally better. Your problem determines the right tool.
What comes next for Roc
Feature parity is a milestone, not a release. The team aims to ship version 0.1.0 later this year. Until then, early adopters can try the browser-based compiler or build from source. Niclas Åhdén, described as "Roc's most prolific production user," has been filing bug reports and testing the upgrade path.
The Exercism course for Roc got updated too. Aurélien Geron manually updated 108 beginner exercises for the new compiler. That kind of educational infrastructure helps a language grow beyond early adopters.
Frequently Asked Questions
Why did the Roc team rewrite from Rust to Zig?
They wanted to change enough core architectural decisions that a rewrite made more sense than refactoring. Zig's explicit memory control and lack of hidden control flow fit their compiler development needs better than Rust's ownership model.
How long did the Roc Rust-to-Zig rewrite take?
487 days for 300,000 lines of code. This was a full rewrite with architectural changes, not a direct port.
What improvements did the Zig rewrite bring?
Binary sizes dropped by more than half, hot code loading works during development, and the compiler now runs in browsers via WebAssembly.
Is Zig better than Rust for all systems programming?
No. The choice depends on the project. Bun recently moved from Zig to Rust for their JavaScript runtime. Compilers and languages may benefit from Zig's explicit control; applications may benefit from Rust's safety guarantees.
When will Roc version 0.1.0 release?
The team aims to ship 0.1.0 later in 2025. The current feature parity milestone is not a formal release.
Need Help Implementing This?
Evaluating Rust vs Zig for your startup's systems work? Reach out to Logicity's technical team for a consultation on language selection and architecture decisions. We help founders make these calls with data, not hype.
Source: Hacker News: Best
Manaal Khan
Tech & Innovation Writer
Produced with AI assistance and reviewed by the Logicity editorial team. Learn more in our Editorial Policy.
Related Articles
More in Startups & Innovation
Redwood Materials Layoffs Signal Battery Industry Pivot
Redwood Materials cut 135 jobs (10% of staff) while pivoting toward energy storage, just three months after raising $425M at a $6B+ valuation. For executives watching the battery and EV supply chain, this restructuring reveals where smart money is heading as automotive electrification plans cool down.





