4 ms·
We copied libxev's code for the timer heap implementation in Bun for setTimeout & setInterval, and it was a ~6x throughput improvement[0] on Linux compared to o
by Jarred 2y ago
We copied libxev's code for the timer heap implementation in Bun for setTimeout & setInterval, and it was a ~6x throughput improvement[0] on Linux compared to our previous implementation.
[0]: https://twitter.com/jarredsumner/status/1736741811039899871 https://twitter.com/jarredsumner/status/1736741811039899871
- hinkley 2y agoWhy do you suppose node is still 50% faster on this benchmark? v8 trickery or something in the library differences?
- Jarred 2y agoThe timer heap currently lives on a different thread instead of the main thread, which means timers have to be allocated and scheduled separately for each one. Scheduling things to other threads is expensive. The reason it works this way isn't good and we will fix it but haven't prioritized it yet