Deno 2.0 just came out and claimed to be faster than Bun and Node.js and the same way Bun claims to be quicker. This caught my interest, so I decided to put their performance to the test and see how they compare in a real-world scenario.
For a fair comparison, I need to choose a framework compatible with all three JavaScript runtime environments (Node.js, Deno, and Bun). That’s why I decided to use Hono.js, which integrates seamlessly with all three.
OS: Ubuntu 24.04.1 LTS (WSL)
System: Ryzen 5 5500U, 16GB RAM
Node.js: v22.9.0
Deno: v2.0.0
Bun: v1.1.30
Test Command:
bombardier -c 100 -d 30s http://localhost:3000
For benchmarking, I used Bombardier, a Go-based load testing tool that runs for 30 seconds with 100 concurrent connections. Each test was repeated three times to ensure more accurate results, and the average of these runs was taken for each environment.
I selected Hono.js for its flexibility and cross-compatibility. Hono.js allows easy integration with all three JavaScript runtimes — Node.js, Deno, and Bun — making it an ideal framework for this kind of benchmark. It’s lightweight, fast, and has a simple API, which ensures that the performance differences between the runtimes are highlighted without much overhead.
Here are the average and maximum requests per second for each runtime:
(Request/sec)
Winner: Bun
Here are the latency (in milliseconds per request) for each runtime is shown below:
(ms/req)
Winner: Bun (Avg) & Deno (Max)
Analysis and Key Takeaways
Based on the results, the following key points emerged:
Node.js: While Node.js has been the industry standard for server-side JavaScript for years, it shows lower performance in terms of requests per second when compared to both Deno and Bun. Its average latency is also higher, suggesting that it may struggle more under heavy concurrent loads. However, Node.js is still widely adopted for its vast ecosystem and stability in production environments.
Deno 2.0: Deno performed significantly better than Node.js, delivering more than double the requests per second while maintaining a much lower average latency. This indicates that Deno is highly optimized for handling concurrent connections and could be a strong alternative for performance-critical applications. Its modern design and built-in features like TypeScript support give it an edge in newer projects.
Bun: Bun outperformed both Node.js and Deno in terms of raw performance. It handled the highest number of requests per second and maintained the lowest average latency. This makes Bun a compelling option for projects where speed is the top priority. However, it is still a newer runtime, and its ecosystem and community are not yet as mature as those of Node.js.
In this benchmark, I tested the performance of Deno 2.0, Bun, and Node.js using Hono.js as the framework across all three environments. The results clearly show that both Deno and Bun outperform Node.js in terms of raw speed and latency. Bun, in particular, shines in high-performance scenarios, while Deno provides a balanced solution with a focus on modern development features.
While Node.js may not be the fastest option, it remains a reliable choice, especially for projects that rely on its mature ecosystem. On the other hand, if you’re working on a new project and need to maximize performance, both Deno and Bun offer compelling alternatives.
Ultimately, the choice of runtime will depend on your project’s specific needs. For now, Deno and Bun have proven themselves as the new contenders in the JavaScript runtime race, with Bun taking a noticeable lead in performance.
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3