3 ms·
Hi Jarred, I am curious about your insight into the source of Bun's performance advantage over Node.js. The Bun website[1] writes this: Why is Bun fast? .
by nequo 4y ago
Hi Jarred, I am curious about your insight into the source of Bun's performance advantage over Node.js. The Bun website[1] writes this:
Why is Bun fast?
... Zig's low-level control over memory and lack of hidden control flow makes it much simpler to write fast software. ...
Is your sense also that this is the root cause of Bun's outstanding speed? Node.js is written in C++ (although not primarily) which also requires low-level control over memory.
Is there something about C++ that makes it less well-suited than Zig for what Bun does?
Or is the problem with Node.js that it relies too much on JavaScript rather than C++ in hot paths?[2]
[1] https://bun.sh/ https://bun.sh/
[2] https://github.com/nodejs/node https://github.com/nodejs/node
- hiccuphippo 4y agoHe has an answer in this talk around the 11:30 mark: https://youtu.be/eF48Ar-JjT8&t=690 https://youtu.be/eF48Ar-JjT8&t=690
- nonethewiser 4y agoThis is a great question, hope he answers.
- culi 4y agoThose benchmarks may not actually hold up to independent analysis: https://medium.com/deno-the-complete-reference/node-js-vs-deno-vs-bun-server-side-rendering-performance-comparison-f80a5abc766f https://medium.com/deno-the-complete-reference/node-js-vs-de...
- Jarred 4y agoTwo things about the linked benchmark: 1) That benchmark appears to be bottlenecked by the HTTP client — that’s why the numbers are so close for each runtime. Effectively, it is benchmarking the http client and not the http server. The benchmarking tool has to be at least as fast the server and it needs to support HTTP keep alive. That means popular Node.js-based benchmarking tools like autocannon don’t produce useful results in benchmarks like these Instead, a tool like oha or wrk or bombardier is better 2) That benchmark is not using the ReactDOM server build for Bun's runtime, which is used in Bun's benchmark and is part of the next release of react-dom. PR: https://github.com/facebook/react/pull/25597#issuecomment-1302816780 https://github.com/facebook/react/pull/25597#issuecomment-13... Source of Bun's homepage benchmark: https://github.com/oven-sh/bun/blob/9ef33312b1b199931c29c182c4bc3984a944bb9a/bench/react-hello-world/react-hello-world.jsx#L1-L7 https://github.com/oven-sh/bun/blob/9ef33312b1b199931c29c182...
- culi 4y agoThanks for the response. If you haven't already, I'd hit up the author as they've done and continue to regularly do similar benchmarks