🔧 Hono.js Benchmark: Node.js vs. Deno 2.0 vs. Bun — Which Is the Fastest?
Nachrichtenbereich: 🔧 Programmierung
🔗 Quelle: dev.to
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.
Test Environment:
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.
The Framework: Hono.js
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.
Result
Here are the average and maximum requests per second for each runtime:
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.
Conclusion
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.
...
🔧 Easy to Dev a Gpts Chat APP with hono bun htmx
📈 38.93 Punkte
🔧 Programmierung
🔧 Deno or Bun? Or NodeJs?
📈 35.22 Punkte
🔧 Programmierung
🔧 AWS Lambda in Deno or Bun
📈 35.22 Punkte
🔧 Programmierung
🔧 Có thể bạn chưa biết (Phần 1)
📈 34.69 Punkte
🔧 Programmierung
🔧 Deno Fresh PostCSS: Future CSS with Deno
📈 33.75 Punkte
🔧 Programmierung
🔧 Create a Node Server using Hono
📈 27.55 Punkte
🔧 Programmierung
🔧 When to Use Bun Instead of Node.js
📈 25.3 Punkte
🔧 Programmierung
🔧 Rescuing legacy Node.js projects with Bun
📈 25.3 Punkte
🔧 Programmierung
🔧 Bun or Node.js in 2024?
📈 25.3 Punkte
🔧 Programmierung
🔧 Runtime challenge: Bun vs Node
📈 25.3 Punkte
🔧 Programmierung