Is Bun so fast because of Zig? Link to heading
Bun, a modern JavaScript runtime and toolkit, has gained attention as a potential Node.js replacement, boasting superior performance. Notably, Bun is written in Zig, a relatively new system-level programming language. This article explores whether Bun’s impressive speed is directly attributable to its Zig foundation.
Background Link to heading
Bun’s key differences from Node.js in terms of performance are:
- System-level language:
Zig(Bun) vs.C++(Node.js) - JavaScript engine: JavaScriptCore (Bun) vs. V8 (Node.js)
To determine which factor contributes more to Bun’s performance advantage, I conducted a series of experiments.
- Run benchmark scripts in JavaScript using Node.js and Bun
- Execute the same scripts in Chrome and Safari browsers
This approach allows us to compare V8 (Chrome/Node.js) against JavaScriptCore (Bun/Safari) performance.
A few things to note
- Tests limited to macOS due to Safari availability
- Benchmark scripts restricted to client-side JavaScript for browser compatibility
Benchmark Link to heading
Five scripts from Benchmark Games were selected and modified to remove system calls:
- pidigits
- fannkuch-redux
- n-body
- fasta
- binary-trees

The tests were run on Node.js, Bun, Chrome, Safari, and Firefox. A clear trend emerged: when Bun outperformed Node.js, Safari similarly outpaced Chrome, indicating a strong correlation between Node.js/Chrome and Bun/Safari performance.
Not shown in the graph is Deno (also powered by V8) performed within 5% of Node.js across all tests, despite it being a complete rewrite of Node in Rust and not C++.
Conclusion Link to heading
This investigation suggests that Bun’s performance gains in CPU-intensive tasks are primarily attributable to JavaScriptCore’s advantages over V8, rather than Zig itself. However, Zig likely contributes significantly to Bun’s efficiency in system-level operations, such as networking. Further research is needed to validate this hypothesis.