Performance benchmarks for Node 25.6.1, Deno 2.6.9, and Bun 1.3.9, measuring HTTP throughput, JSON parse and stringify, hashing, buffers, and async scheduling.
Bun (same engine as Safari but without needing to apologise for Safari):
[17.52ms] Loop
[297.17ms] Generator
Generators are going to be slow because:
they’re going to be stack switching so much in JS runtimes which adds a lot of overhead
JS doesn’t have the other language features (yet) that you want to use with generators, which makes less folks want to use generators, which makes implementers not want to spend time optimising them. (Why bother trying to inline generator state when it’s probably going to change once the adjacent features come in?)
Until generators don’t rely on stack switching, they’re always going to be super slow.
Bro, how are generators going to be faster?
This is an AI article.
My results:
Firefox:
Node (uses same engine as deno, chrome, edge):
Safari (uses same engine as bun):
Bun (same engine as Safari but without needing to apologise for Safari):
Generators are going to be slow because:
Until generators don’t rely on stack switching, they’re always going to be super slow.