TL;DR
Bun has integrated a Rust rewrite that passes all tests, reduces binary size, and improves memory safety. The update is in canary testing, with wider release pending. This marks a significant step for Bun’s stability and performance.
The Bun team has merged a rewrite of the JavaScript runtime in Rust, marking a significant milestone in its development. The update improves performance, reduces binary size, and introduces compiler-assisted tools for catching memory bugs, which previously caused substantial debugging challenges. This development is currently in canary testing, with a wider release planned after additional optimizations.
According to the Bun team, the Rust rewrite has passed all existing tests, including Bun’s pre-existing test suite on all platforms. The new codebase retains the same architecture and data structures as before, with minimal dependencies, and does not include async Rust. The binary size has decreased by 3 to 8 MB, and benchmarks indicate performance is neutral to faster. A key benefit is the introduction of compiler-assisted memory safety tools, which aim to reduce bugs and debugging time. The team has advised users to try the update via ‘bun upgrade –canary’ and to report issues. Some cleanup and optimization work remains before this version is integrated into the stable release.
Why It Matters
This update is significant because it enhances Bun’s performance and stability, addressing long-standing issues related to memory bugs and flaky tests. The Rust rewrite enables safer code, reduces binary size, and potentially improves startup and runtime speeds. For developers relying on Bun for server-side JavaScript, these improvements could translate into more reliable and efficient applications. The move also signals Bun’s commitment to leveraging Rust for core runtime components, aligning with broader industry trends towards safer, faster runtimes.

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 aiming to compete with Node.js and Deno, known for its speed and minimal dependencies. Previous versions faced challenges with memory leaks and flaky tests, which the team has been addressing through various optimizations. The decision to rewrite in Rust represents a strategic shift towards safer, more predictable code. The integration of Rust-based components has been in planning stages for some time, with initial tests showing promising results. The current merge follows extensive testing and incremental improvements, with the team emphasizing ongoing cleanup and performance tuning before full release.
“The Rust rewrite passes all our tests and fixes several memory leaks and flaky tests, with binary size shrinking significantly.”
— Bun team member
“The new codebase retains the same architecture and data structures, ensuring compatibility and stability.”
— Bun developer

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 fully integrated into the stable release of Bun. The team has indicated ongoing optimization and cleanup work, and wider deployment will depend on further testing and user feedback. Details about potential performance differences in real-world applications remain to be seen, and some users may encounter bugs or issues during the canary phase.
binary size reduction tools
As an affiliate, we earn on qualifying purchases.
As an affiliate, we earn on qualifying purchases.
What’s Next
The next steps include continued testing and optimization of the Rust rewrite, with the team planning follow-up PRs for cleanup and performance improvements. Once stability is confirmed, the update will be rolled out to a broader user base. Developers are encouraged to try the canary build and report issues to help refine the release.
memory safety debugging tools
As an affiliate, we earn on qualifying purchases.
As an affiliate, we earn on qualifying purchases.
Key Questions
What is the main benefit of the Rust rewrite for Bun?
The rewrite improves performance, reduces binary size, and introduces compiler-assisted tools for catching memory bugs, enhancing stability and developer productivity.
Will this change affect existing Bun users?
For most users, the update should be transparent, but early testing is in the canary phase. Users should try ‘bun upgrade –canary’ and report issues to aid stability.
When will the Rust-based version be available in the stable release?
There is no fixed date yet; the team is focusing on testing and optimization before wider deployment. It will depend on the results of ongoing testing and user feedback.
Does the Rust rewrite mean Bun now uses Rust for all its core components?
Not entirely; the current merge focuses on the runtime core. Future updates may expand Rust use, but for now, the core runtime is the primary component rewritten in Rust.