You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is not a bug and setInterval() is working as expected. There are reasonable limitations in the way timers work in single threaded event loops and this is just highlighting those. Recommend marking this issue as invalid and closing.
The explanations above are not incorrect (node is not a real-time system) but the core issue here is the default 64 Hz granularity of timers on Windows, meaning the operating system groups timers in intervals of 1,000/64 = 15.625 ms. A 10 ms timer is prone to getting rounded up to the next interval.
Note how 64 is very close to the 66 calls/sec you're seeing. For comparison, on my Linux machine it hovers around ~97 calls/sec.
One improvement node could maybe make is call timeBeginPeriod(1) to request better timer granularity (like e.g. Chrome does) but that's a precision-vs-efficiency trade-off. Higher precision means higher CPU usage, ceteris paribus.
bnoordhuis
added
timers
Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout.
windows
Issues and PRs related to the Windows platform.
labels
Mar 1, 2025
Version
22.9
Platform
Subsystem
No response
What steps will reproduce the bug?
node
How often does it reproduce? Is there a required condition?
.
What is the expected behavior? Why is that the expected behavior?
100/s
What do you see instead?
66/s
Additional information
No response
The text was updated successfully, but these errors were encountered: