Analysis of changes in the Bun codebase after the rewrite from Zig to Rust
The Bun codebase has undergone a significant rewrite from Zig to Rust, resulting in a substantial increase in lines of code. The analysis highlights the number of tests and their coverage density, noting a decrease in test density after the transition. The article emphasizes the importance of thorough testing for runtime reliability, especially when implementing large changes.
- ▪The Bun codebase increased from 630,690 lines of Zig to 899,067 lines of Rust.
- ▪There are a total of 20,191 tests in the Bun repository, with a test coverage density of 1 test per 44 lines of code in Rust.
- ▪The article suggests that more tests are needed when changing an implementation compared to ordinary product evolution.
Opening excerpt (first ~120 words) tap to expand
Analysis of changes in the Bun codebase after the rewrite from Zig to Rust May 16, 2026 I was a bit carried away by the hype around rewriting Bun in Rust. I decided to see what that means in practice. I won’t draw any conclusions; I’ll only highlight points that seem important to me and give numbers for discussion. The commit where the changes happened is https://github.com/oven-sh/bun/commit/23427dbc12fdcff30c23a96a3d6a66d62fdc091d. To start, I quickly checked what happened with the tests. In the Bun repository I only see integration tests. These integration tests have the following characteristics. 18,610 tests exist. The real number is probably several thousand higher, because I counted with grep, not at runtime.
…
Excerpt limited to ~120 words for fair-use compliance. The full article is at Андрій-Ка.