Jarred tried rewriting Bun in Rust and it passes 99.8% of the existing test suite we're not being ambitious enough

TL;DR

Jarred has rewritten Bun, a JavaScript runtime, in Rust, achieving 99.8% test suite pass rate. This development highlights progress in creating a performant, Rust-based alternative to Bun.

Jarred announced that his Rust-based rewrite of Bun, a JavaScript runtime, now passes 99.8% of its existing test suite, marking a significant technical milestone.

According to Jarred, the developer behind the project, the Rust rewrite of Bun has successfully passed 99.8% of the test suite designed for the original JavaScript runtime. This achievement indicates that the Rust version is highly compatible with existing functionalities and could serve as a performant alternative.

The project aims to create a faster, more memory-efficient runtime by leveraging Rust’s safety and performance features. The test suite, which includes thousands of tests covering core functionalities, was used to measure compatibility and stability. Jarred emphasized that the current pass rate shows substantial progress, though some edge cases remain untested or unverified.

Why It Matters

This development is significant because Bun is a popular JavaScript runtime known for its speed and efficiency. A Rust implementation passing nearly all tests could lead to a new, high-performance runtime option for developers, potentially impacting the ecosystem of Node.js and other JavaScript engines. It also demonstrates the viability of rewriting complex runtimes in Rust, which is valued for its safety and concurrency capabilities.

The Rust Programming Language, 3rd Edition

The Rust Programming Language, 3rd Edition

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Background

Bun was originally developed as an alternative JavaScript runtime aiming to improve performance over Node.js and Deno. Its core codebase is primarily written in JavaScript and C++, and it has gained popularity for its speed and modern features. The effort to rewrite Bun in Rust has been ongoing, motivated by Rust’s safety guarantees and potential for performance gains. Prior to this milestone, the project was in early testing phases, with compatibility still being refined.

“The Rust rewrite of Bun now passes 99.8% of the test suite, and we’re not being ambitious enough.”

— Jarred

“Achieving such a high pass rate in the test suite demonstrates that Rust can be a viable language for runtime development.”

— Unspecified developer

Amazon

JavaScript runtime performance benchmarks

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

What Remains Unclear

It is still unclear how the remaining 0.2% of the test suite will be addressed, and whether the Rust version can fully match all features of the original Bun. Additionally, the performance and stability in real-world scenarios are yet to be tested extensively.

Bun Runtime Essentials: The Fastest JavaScript Server Environment: Bun Runtime Essentials: The Fastest JavaScript Server Environment

Bun Runtime Essentials: The Fastest JavaScript Server Environment: Bun Runtime Essentials: The Fastest JavaScript Server Environment

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

What’s Next

Next steps include refining the remaining test cases, optimizing performance, and conducting real-world benchmarks. The project team may also seek community feedback and contributions to improve compatibility and stability further.

Amazon

Rust-based server runtime

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Key Questions

How does the Rust version of Bun compare in performance to the original?

Performance benchmarks are still in development, but the high test suite pass rate suggests potential for comparable or improved performance. Actual benchmarks are expected in the coming months.

Will this Rust rewrite replace the original Bun?

There are no immediate plans to replace Bun, but the Rust version could serve as an alternative or experimental branch, depending on stability and performance outcomes.

When will the Rust version be available for public testing?

There is no official release date yet. The project is currently in testing and development phases, with ongoing improvements expected.

What are the main advantages of rewriting Bun in Rust?

Rust offers safety guarantees, memory efficiency, and potential performance improvements, which could make the runtime faster and more reliable.

You May Also Like

ShinyHunters Claims Second Attack Against Instructure

ShinyHunters has announced a second cyberattack targeting Instructure, raising concerns over data security and breach response. Details are still emerging.

AI Agents Have Two Souls. You Only Control One

New insights reveal AI agents comprise a deterministic core and a probabilistic LLM, raising security and control challenges.

The Smart Home Security Basics Most People Ignore

The smart home security basics most people ignore could leave your devices vulnerable—discover the essential steps to keep your home truly protected.

The Simple Way to Secure Your Accounts Without Memorizing Anything

Secure your accounts effortlessly with a password manager and multi-factor authentication—discover how to protect your digital life today.