Great article but there was a point in your article -
Ah, but Bun is surely different? Right? I mean, it's written with ZIG! And ZIG! is super fast.... right? Eh, not really. It isn't doing anything magical, ultimately any performance you can achieve with it could be achieved with C++ (what Node.js is written in)
The reason why Bun appears faster than Node.js in some cases is because Bun leverages Safari's WebKit engine. This engine, optimized for web-related tasks and JavaScript execution, can indeed make a substantial difference in performance compared to Node.js, which relies on the V8 engine.
It's fascinating how the choice of a runtime engine can impact performance, and Bun's utilization of WebKit certainly plays a role in its speed.
Yes it does! I skipped over that, but it's a very valid point. I'm actually most excited about their usage of Webkit rather than V8. There was a point where Microsoft had made a version of Node.js based on Chakra (Internet Explorer/Edge's JS Engine) instead of V8. And had Edge not switched to being Chromium based they would have continued to maintain node-chakracore. I was very interested then, as I am now with Bun, on what unique, weird niche things one engine will excel at over another. Overall though I think most of the speed differences come from unoptimized Node rather than V8 specifically. This can be seen by how Bun allows you to use Node's API for Filesystem stuff, but even using Bun/Webkit it is still slower than Bun's custom native API's.
But we'll see. Again, excited to find what weird things Webkit is better for over V8 in this new context. It will be a better comparison if Node renews a focus on performance, which I assume they will in the coming year.
This engine, optimized for web-related tasks and JavaScript execution, can indeed make a substantial difference in performance compared to Node.js, which relies on the V8 engine.
Is V8 not « optimized for web-related tasks and JavaScript execution» ?
Great article but there was a point in your article -
The reason why Bun appears faster than Node.js in some cases is because Bun leverages Safari's WebKit engine. This engine, optimized for web-related tasks and JavaScript execution, can indeed make a substantial difference in performance compared to Node.js, which relies on the V8 engine.
It's fascinating how the choice of a runtime engine can impact performance, and Bun's utilization of WebKit certainly plays a role in its speed.
Yes it does! I skipped over that, but it's a very valid point. I'm actually most excited about their usage of Webkit rather than V8. There was a point where Microsoft had made a version of Node.js based on Chakra (Internet Explorer/Edge's JS Engine) instead of V8. And had Edge not switched to being Chromium based they would have continued to maintain
node-chakracore. I was very interested then, as I am now with Bun, on what unique, weird niche things one engine will excel at over another. Overall though I think most of the speed differences come from unoptimized Node rather than V8 specifically. This can be seen by how Bun allows you to use Node's API for Filesystem stuff, but even using Bun/Webkit it is still slower than Bun's custom native API's.But we'll see. Again, excited to find what weird things Webkit is better for over V8 in this new context. It will be a better comparison if Node renews a focus on performance, which I assume they will in the coming year.
Is V8 not « optimized for web-related tasks and JavaScript execution» ?
JavascriptCore has a faster startup time, otherwise they benchmark similarly. V8 is a HIGHLY optimized JS engine. Both have pros and cons
Compared to webkit javascriptCore it is slow