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)
I tried it in about:blank but it does the same. Maybe there is some extension in my browser that slows it down (somehow). Im running tampermonkey but it’s not active on any pages I tried this on.
I ran the script in nodejs and everything works perfectly, the sleep time is very close to the original value so it’s definitely something inside browser that causes it to lag.