Why would anybody not use Bun, other than the cost of migration, given the performance improvement?
Nevertheless, amazing performance. Feels refreshing to see more improvements to the JS/TS community.
Why would anybody not use Bun, other than the cost of migration, given the performance improvement?
Nevertheless, amazing performance. Feels refreshing to see more improvements to the JS/TS community.
Most of Bun is written in native code (zig) rather than JavaScript. We leverage modern CPU features like SIMD, closely watch syscall overhead and spend a lot of time reading about system calls and platform-specific system APIs
Bun is still pretty early - we are not at 1.0 yet. There are crashes and many bugs to fix, but we are making steady progress towards a stable release
However, it's worth noting that those benchmarks have been critized a lot for being cherry-picked and not very representative of real-world use-cases
I've tried to look it up a number of times but I've yet to come across any benchmarks done by an independent party (please share if you find some)
But I have worked _with_ node for a very long time, and I am intensely familiar with the JS ecosystem's "flavour of the day" culture.
I think people are rightfully suspicious of such bold claims. Particularly as Deno came out to much fanfare and self promotion but like...I barely hear of anyone actually using it in production as opposed to node.
Not saying that node will be King forever, just that I'm taking a grain of salt.
What seems clear though is that Bun/Jarred really care about performance, since it's a big part of the tweeting/public communication. Maybe the tests are not the best from a real-world comparison, but the fact that he's constantly trying to make every small thing high performance would suggest that performance IS important for Bun. So people might disagree on "how much better", but I'd not be surprised at all if a system built from the ground up with a big focus on performance is faster than the competition.
It's probably a decent tradeoff in a lot of applications, but probably not in all of them.
Bun isn't scheduling the garbage collector between microtask ticks and we might need to start doing that to reduce memory usage. We did that in Bun v0.3 for the event loop, but we didn't do it for the microtask queue.
But you bring up a good point and I'd like to see a more holistic benchmark that takes both space and time complexity into account (preferably done by an independent party)
There's limited resources on each team and I suspect the biggest difference here is differing priorities for those resources. There's not many third-party comparisons, but here's two.
https://medium.com/deno-the-complete-reference/hello-world-p...
https://medium.com/walmartglobaltech/react-native-memory-pro...
Edit: That same blog also did a comparison of Bun and Deno directly. Looks like Deno usually outperformed Bun pretty significantly:
https://medium.com/deno-the-complete-reference/deno-vs-bun-p...
v8 has a compacting GC[0] while JSC does not[1]. This was the result of the v8 team taking out a bunch of time to write a new GC that was released in 2018 (Orinoco).
Here's a comparison of a simple job. With lots of concurrency, Bun is 20-30% faster, but uses 60% more memory.
https://medium.com/deno-the-complete-reference/hello-world-p...
Here's a little about JSC, Hermes, and v8 memory in React Native.
https://medium.com/walmartglobaltech/react-native-memory-pro...
[0] https://v8.dev/blog/trash-talk
[1] https://webkit.org/blog/12967/understanding-gc-in-jsc-from-s...
That benchmark is out of date. In Bun v0.3, memory usage in situations like that dropped by 4x - https://bun.sh/blog/bun-v0.3.0, meaning it uses around half as much memory as Node.
Prior to Bun v0.3, Bun wasn't scheduling the garbage collector in conjunction with the event loop and that led to memory not being reclaimed correctly on idle
https://medium.com/deno-the-complete-reference/node-js-vs-de...
From another comment:
Reasons not to use bun:
- it is pre v1, so unstable API
- it is unstable, so you will deal with crashes
- newer, so help articles will be hard to find
You're thinking of the io.js debacle