Repository navigation
Conversation
Merged
In Node, setTimeout is scheduled against libuv's integer-millisecond loop clock and can fire a fraction of a millisecond before performance.now() reaches the target time. The timer then isn't yet due, so it waits another frame (17ms) before firing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mbostock
force-pushed
the
mbostock/timeout-ceil
branch
from
November 3, 2026 00:19
ab8f1a0 to
8200166
Compare
Member
Author
|
Superseded by #61 (GitHub won’t retarget a stacked PR). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In Node,
setTimeoutis scheduled against libuv’s integer-millisecond loop clock and can fire a fraction of a millisecond beforeperformance.now()reaches the target time. When that happens,wakefinds the timer isn’t yet due and waits another frame, so timers with delays over 24ms fire ~17ms late. This rounds the timeout delay up.This is one of two causes of flaky tests under current Node (e.g.
66.58 should be in range of [40, 60]); the other, tests seeing anow()cached by the previous test, is fixed in #58, which will be rebased onto this once merged.🤖 Generated with Claude Code