mirror of
https://github.com/oven-sh/bun
synced 2026-02-11 11:29:02 +00:00
### What does this PR do? Instead of calling event_loop.wakeup() (which writes to the eventfd) when there are pending immediate tasks, use a zero timeout in getTimeout() so epoll/kqueue returns immediately. This avoids the overhead of the eventfd write/read cycle on each setImmediate iteration. On Windows, continue to call .wakeup() since that's cheap for libuv. Verified with strace: system bun makes ~44k eventfd writes for a 5s setImmediate loop, while this change makes 0. ### How did you verify your code works? --------- Co-authored-by: Claude Bot <claude-bot@bun.sh> Co-authored-by: Claude <noreply@anthropic.com>