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

Javascript: Guia do Programador

Javascript: Guia do Programador

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.

Deno Demystified: Build Secure JavaScript Servers: A beginner’s guide to Deno – the modern Node.js alternative – through real-world projects

Deno Demystified: Build Secure JavaScript Servers: A beginner’s guide to Deno – the modern Node.js alternative – through real-world projects

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

Electrobun 2.0 will be decoupled from Bun due to the Rust rewrite

Electrobun 2.0 will be separated from Bun due to a major rewrite in Rust, marking a significant shift in its development approach.

Cordless Vacuum Basics: Power, Airflow, and What to Ignore

Understanding cordless vacuum basics—power and airflow—reveals what truly impacts cleaning performance, so keep reading to learn what features to ignore.

The Apple Studio Display could have been so much more

Despite upgrades, the Apple Studio Display remains limited compared to competitors, with outdated panel tech and minimal adjustability, raising questions about its value.

My thoughts after using Clojure for about a month

A developer shares their experiences after a month of using Clojure for personal projects, highlighting its strengths, challenges, and future plans.