Latency Distribution Results for Bun and Node.js
The latency distribution results for Bun and Node.js highlight their performance under load, particularly in terms of average latency and response times during benchmarking tests.
Node.js Latency Distribution
In a benchmark test conducted on Node.js, the results were as follows:
- Average Latency: 73.32 ms
- Latency Distribution:
- 50%: 13.74 ms
- 75%: 14.93 ms
- 90%: 79.47 ms
- 99%: 1.23 s
This indicates that while Node.js can handle a significant number of requests per second (around 17,846), there are instances of higher latency, particularly at the 99th percentile, where response times can spike to over a second[1].
Bun Latency Distribution
For Bun, the latency distribution results from similar benchmarking tests showed:
- Average Latency: 5.42 ms
- Latency Distribution:
- 50%: 5.28 ms
- 75%: 5.80 ms
- 90%: 6.04 ms
- 99%: 6.77 ms
Bun demonstrated a significantly lower average latency and consistently lower response times across all percentiles compared to Node.js, processing approximately 46,849 requests per second in this test[1][2].
Summary of Findings
- Bun outperforms Node.js in terms of average latency and latency distribution across all percentiles, indicating a more consistent and faster response time under load.
- Node.js, while still capable of handling high throughput, shows greater variability in latency, especially at the higher percentiles.
These results suggest that Bun may be better suited for applications where low-latency responses are crucial, while Node.js remains a robust choice for many existing applications due to its maturity and extensive ecosystem.
Citations:[1] https://dev.to/kostyatretyak/a-quick-overview-of-buns-basic-features-and-a-comparison-with-nodejs-3o1a
[2] https://docs.zcloud.ws/blog/2024-03-04-bun-node-js-a-load-testing-experiment
[3] https://5ly.co/blog/bun-vs-node-comparison/
[4] https://github.com/ishtms/learn-nodejs-hard-way/blob/master/chapters/ch00-nodejs-faster-than-you-think.md
[5] https://www.educative.io/answers/bun-vs-nodejs-a-comparative-analysis
[6] https://www.harperdb.io/post/is-bun-the-new-node-js
[7] https://www.dreamhost.com/blog/bun-vs-node/
[8] https://www.linkedin.com/pulse/nodejs-vs-bun-10-javascript-runtime-rumble-arbisoft