this post was submitted on 08 Jul 2023
8 points (90.0% liked)
JavaScript
1968 readers
1 users here now
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I don't know anything about JS, but those timings are suspiciously close to integer multiples of your sleep duration, after the first.
Based on what you've shown, "All over place" is not what I'd call it. It either fires "on time" or takes "exactly-ish" twice as long.
I said all over the place because I've seen numbers like 1.7 seconds, 2.8 seconds and so on. But it does mostly land on integer multiples.
Anyway, tried to run this in nodejs and it works as expected - so the conclusion is that it's somehow a limitation in browser engine (V8 in this case)