TL;DR

Bun has merged a significant rewrite in Rust, passing all pre-existing tests, fixing memory leaks, and improving performance. The update is in the canary stage, with further optimization planned before wider release.

The Bun JavaScript runtime has completed a merge of its codebase rewritten in Rust, passing all existing tests and fixing several memory leaks, according to a recent developer update.

The development team announced that the Rust rewrite of Bun has been merged into the main codebase. This version passes Bun’s pre-existing test suite across all platforms and addresses memory leaks and flaky tests previously identified. The binary size has been reduced by between 3 MB and 8 MB, and benchmark results indicate performance improvements, ranging from neutral to faster speeds. The codebase remains largely unchanged in architecture and data structures, with minimal third-party dependencies and no async Rust components. The update is currently available in the canary channel via the command ‘bun upgrade –canary’. The team emphasizes that additional optimization and cleanup work are ongoing, with further PRs planned before this version is released outside the canary channel.

Why It Matters

This merge marks a major milestone for Bun, as rewriting critical parts of the runtime in Rust aims to improve stability, performance, and developer productivity. The integration of compiler-assisted tools for memory bug detection could reduce debugging time and increase reliability, impacting the broader JavaScript runtime ecosystem by demonstrating the viability of Rust for high-performance, low-level runtime components.

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 is a JavaScript runtime built for speed and efficiency, competing with Node.js and Deno. The project announced plans to rewrite parts of its core in Rust to address performance bottlenecks and stability issues. The recent merge follows months of development and testing, including a successful pass of all existing test suites and fixing known memory leak issues. The transition to Rust has been a key focus, as it allows for better memory safety and performance optimizations, with the team maintaining a largely unchanged architecture and minimal dependency footprint.

“The Rust rewrite has passed all our tests, fixed several memory leaks, and improved performance metrics. We are now in the canary phase and plan to optimize further before a stable release.”

— Bun development team

“The integration of compiler-assisted tools for catching memory bugs will significantly reduce debugging time and improve reliability.”

— Lead developer (unnamed)

Introduction to JavaScript Runtime Architecture: Event Loops Module Loaders and Native Performance Optimization

Introduction to JavaScript Runtime Architecture: Event Loops Module Loaders and Native Performance Optimization

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

What Remains Unclear

It remains unclear when the Rust-based version will be available in the stable release channel, as further optimization and testing are ongoing. Details about the timeline for broader deployment are not yet confirmed.

Certified A/C Pro UV Leak Detection Kit

Certified A/C Pro UV Leak Detection Kit

High-intensity true ultraviolet leak detection penlight and AAA batteries

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

What’s Next

The team will continue refining the Rust implementation through additional PRs, with plans to address remaining bugs and performance issues. A non-canary, stable release is expected once testing and optimization are complete, likely within the coming months.

8 Pack Art Acoustic Panels Sound Absorbing Programming Code Computer Python Binary Code Software Decorative Soundproof Wall Panels Self Adhesive for Home Recording Studios 48"x32"

8 Pack Art Acoustic Panels Sound Absorbing Programming Code Computer Python Binary Code Software Decorative Soundproof Wall Panels Self Adhesive for Home Recording Studios 48"x32"

Premium Materials: The complete acoustic panel set consists of 8 pieces, each measuring 12"x16"x0.4". When assembled, the overall…

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Key Questions

What are the main benefits of the Rust rewrite for Bun?

The Rust rewrite aims to improve performance, reduce binary size, fix memory leaks, and introduce compiler-assisted tools for better memory safety and debugging.

When will the new Rust version be available outside the canary channel?

The exact timeline is not confirmed, but a stable release is expected after further testing and optimization, likely within the next few months.

Does the Rust rewrite change Bun’s architecture?

No, the core architecture and data structures remain largely the same, with minimal dependency changes.

Are there any known issues with the current canary version?

Yes, ongoing work includes further optimization and cleanup, and users are encouraged to file issues if they encounter problems.

You May Also Like

Google’s AI search is so broken it can ‘disregard’ what you’re looking for

Google’s AI Overviews are currently misinterpreting certain action-related queries, including ‘disregard,’ leading to broken or irrelevant responses, Google confirms.

Wi-Wi is wireless time sync at 1 nanosecond

Wi-Wi, a Japanese-developed wireless synchronization protocol, demonstrates time accuracy down to 1 nanosecond, promising significant advances in broadcast and industrial tech.

Internet of Shit: AI Poop Analysis App Offered to Sell Me Database of Its Users’ Poops

A developer of a stool analysis app is offering a database of 150,000 user images for sale, raising concerns over data privacy and misuse.

US reportedly allows 10 Chinese companies to buy NVIDIA’s coveted H200 AI chips

The US reportedly permits 10 Chinese companies to buy NVIDIA’s H200 AI processors, marking a potential shift in export controls amid ongoing tensions.