TL;DR
The Bun team has merged a significant rewrite of parts of the runtime in Rust. The update passes all existing tests, reduces binary size, and offers performance improvements. The change aims to improve stability and developer productivity.
The Bun team has merged a rewrite of its core engine in Rust, marking a major milestone in the project’s development. The update aims to improve performance, stability, and developer productivity, and is now available for testing via the –canary upgrade command.
The recent merge involves rewriting parts of Bun’s codebase in Rust, which has successfully passed all of Bun’s existing test suite across multiple platforms. The update also addresses several memory leaks and flaky tests, contributing to enhanced stability. Additionally, the binary size has been reduced by 3 to 8 MB, and benchmark results indicate performance improvements that are neutral or faster than previous versions.
According to the team, the core architecture and data structures remain largely the same, with minimal third-party dependencies. The Rust code integrates with Bun’s existing system, and the team emphasizes that no asynchronous Rust features are used. The merge also introduces compiler-assisted tools for detecting and preventing memory bugs, which have historically consumed significant debugging time.
Why It Matters
This development is significant because it represents a major step toward making Bun more stable, faster, and easier to maintain. The use of Rust for core components leverages its memory safety features, potentially reducing bugs and security vulnerabilities. For developers, this could mean a more reliable runtime and faster iteration cycles, impacting the broader JavaScript runtime ecosystem.

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.
Background
Bun is an alternative JavaScript runtime focusing on performance and developer experience. Prior to this merge, Bun primarily used C++ and some third-party libraries. The team has been exploring Rust as a way to improve safety and performance. The current merge is part of ongoing efforts, with further optimization and cleanup work planned before this version is included in the stable release.
“The Rust rewrite passes all our pre-existing tests, fixes memory leaks, reduces binary size, and offers performance gains. It’s a significant step forward.”
— Bun team member
“Compiler-assisted tools for memory safety will help us catch bugs earlier and reduce debugging time moving forward.”
— Bun developer
Rust programming books
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 this Rust-based code will be fully integrated into the stable release of Bun, or how it will perform under widespread production use. Further optimization and testing are ongoing, and the team has indicated additional cleanup work is planned.
performance testing tools for developers
As an affiliate, we earn on qualifying purchases.
As an affiliate, we earn on qualifying purchases.
What’s Next
The next steps include further optimization, bug fixing, and code cleanup before this Rust rewrite is merged into the non-canary, stable version of Bun. The team also plans to monitor user feedback from the canary release and address any issues that arise.
memory leak detection software
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 performance?
The rewrite is expected to improve performance and stability, with benchmark results showing neutral to faster performance compared to previous versions.
Will this change affect existing Bun users?
For now, the update is available via the –canary upgrade command. Once fully integrated into the stable release, users should experience improved stability and performance.
Are there any risks associated with this Rust rewrite?
The team reports passing all tests, but as with any major code change, some unforeseen issues could arise during wider testing and deployment.
When will this Rust-based version be available in the stable release?
The team has not provided a specific timeline but indicates that additional cleanup and optimization are needed before full deployment.
What are the benefits of using Rust in Bun?
Rust offers memory safety, reduced bugs, and potential performance enhancements, which can lead to a more reliable and efficient runtime.