TL;DR

Bun has merged a significant rewrite in Rust, passing all pre-existing tests, fixing memory leaks, reducing binary size, and maintaining performance. This development aims to improve stability and developer productivity.

The Bun JavaScript runtime has completed a major code rewrite in Rust, passing all existing tests and fixing several memory leaks, marking a significant milestone in its development.

According to a recent developer update, the Bun team has merged a rewrite of its core codebase in Rust. The new version passes Bun’s pre-existing test suite across all platforms and addresses several memory leaks and flaky tests. The binary size has been reduced by between 3 MB and 8 MB, and benchmarks indicate performance is at least maintained and potentially improved. The rewrite retains the same architecture and data structures, with minimal external dependencies, and does not include asynchronous Rust features. Developers are encouraged to test the canary version using the command ‘bun upgrade –canary’ and report issues. The team notes ongoing work to optimize further and prepare for a stable release, with additional cleanup and improvements planned in subsequent pull requests.

Why It Matters

This development is significant because it marks a shift towards a more memory-safe and potentially more performant core for Bun, which is gaining popularity as a JavaScript runtime alternative. The use of Rust aims to improve stability, reduce debugging time, and streamline future development. For developers, this could translate into more reliable applications and a smoother development experience, especially in performance-critical environments.

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 has been under active development as a fast JavaScript runtime built with a focus on performance and low resource usage. Previously, it relied on a mix of JavaScript and some external libraries, with ongoing efforts to improve stability and efficiency. The recent merge of the Rust rewrite follows a series of internal tests and benchmarks, with the team emphasizing that the code structure remains largely unchanged, aside from the language switch. The move to Rust is part of a broader trend in the JavaScript ecosystem to adopt safer, more efficient systems programming languages for core components.

“The rewrite in Rust passes all tests, fixes memory leaks, and reduces binary size. Benchmarks are neutral to faster, and we now have compiler-assisted tools for catching memory bugs.”

— Bun developer on Hacker News

“We’re still doing some optimization and cleanup work before this lands in the stable version. Please try the canary and report issues.”

— Bun team spokesperson

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 Remains Unclear

It is not yet clear when the Rust-based version will be officially released to all users or how it will impact existing workflows in production environments. Details about long-term stability and compatibility are still emerging.

Rotation Tester and AC Detector for Circulating Pumps etc

Rotation Tester and AC Detector for Circulating Pumps etc

Quickly indicates rotation direction

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

What’s Next

The team plans to continue optimization, bug fixing, and cleanup in follow-up PRs. A stable release is anticipated once testing in the canary version confirms reliability. Users are encouraged to try the canary build and provide feedback.

Memory Leaks in Java: Detection and Fixing: A Practical Guide to Identifying, Analyzing, and Resolving Memory Issues in Java Applications

Memory Leaks in Java: Detection and Fixing: A Practical Guide to Identifying, Analyzing, and Resolving Memory Issues in Java Applications

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Key Questions

What does the Rust rewrite mean for Bun users?

The rewrite aims to improve stability, reduce bugs, and potentially boost performance, making Bun more reliable for production use.

When will the new version be officially released?

The team has not provided a specific release date but expects to finalize testing and optimizations before a stable release, possibly within the coming months.

Will this change affect existing Bun projects?

Most existing projects should remain compatible, as the architecture and data structures are largely unchanged. However, users should test their projects with the canary build for compatibility issues.

Are there any known issues with the current merge?

As of now, the merge is considered successful, but ongoing testing may reveal bugs or performance issues that are being addressed in follow-up updates.

You May Also Like

Why File Compression Can Ruin Large Prints If Done Wrong

Freeing up space with compression can ruin large prints if done improperly, risking loss of detail and quality—learn how to avoid these pitfalls.

Sony’s Xperia 1 VIII has bigger camera sensors and a new look

Sony launches Xperia 1 VIII featuring bigger camera sensors, a redesigned look, and advanced AI photography features, exclusive to Europe.

Artificial Intelligence in Art: Collaborator or Competitor?

Navigating the evolving landscape of AI in art reveals a complex dynamic where collaboration and competition collide, leaving one question—what’s next?

Firefox Merges Support for Vulkan Video Decoding

Firefox 153 will include support for Vulkan Video decoding, enhancing GPU acceleration for video playback across platforms, expected on July 21.