1. Introduction
Performance is a critical factor when choosing a JavaScript runtime. This document compares Deno, Bun, and Node.js based on execution speed, startup time, HTTP request handling, and other key benchmarks.
2. Performance Comparison
2.1 Startup Time
- Bun has the fastest startup time due to its optimized JavaScript engine.
- Deno is faster than Node.js, thanks to Rust's efficient memory management.
- Node.js has slower startup times due to legacy design choices.
2.2 HTTP Server Performance
To test real-world performance, I implemented a custom HTTP application server that generates mock data based on configuration settings. I ran the server using Node.js 22, Deno 2.0, and Bun 1.2.0.
Benchmark Results (Requests Per Second - RPS)
Runtime | RPS (higher is better) |
---|---|
Node.js 22 | 30,000 |
Deno 2.0 | 38,000 |
Bun 1.2.0 | 58,000 |
- Bun 1.2.0 delivered the highest RPS, showcasing its speed advantage.
- Deno 2.0 outperformed Node.js significantly, handling more concurrent requests efficiently.
- Node.js 22 performed well but was the slowest among the three.
2.3 File System Operations
- Bun is optimized for fast file reads and writes.
- Deno performs better than Node.js in handling file system tasks due to Rust’s efficiency.
- Node.js has good file I/O performance but lags behind Bun and Deno in direct comparisons.
2.4 Package Management Speed
- Bun installs and executes npm packages significantly faster than both Deno and Node.js.
- Deno has built-in module handling but is slower than Bun for npm compatibility.
- Node.js uses npm, which is the slowest in package installation.
3. Benchmarks Summary
The following are updated benchmark results:
Task | Node.js 22 | Deno 2.0 | Bun 1.2.0 |
---|---|---|---|
Startup Time | 120ms | 80ms | 5ms |
HTTP Requests (RPS) | 30k | 38k | 58k |
File Read Speed | 50ms | 40ms | 25ms |
npm Package Install | Slow | Moderate | Fast |
4. Conclusion
- Bun is the fastest in almost every category, making it ideal for performance-intensive applications.
- Deno offers better performance than Node.js, particularly in concurrent tasks.
- Node.js remains stable but is the slowest of the three.
If performance is your main concern, Bun is the best choice, followed by Deno, with Node.js still being a reliable option for legacy applications.
My custom HTTP server saw a significant performance boost when switching from Node.js 22 to Deno 2.0 and Bun 1.2.0, highlighting how modern runtimes optimize execution and request handling.
Top comments (0)