Comment by nielsbot

Comment by nielsbot 9 hours ago

4 replies

I remember reading that high precision timers can be used for browser fingerprinting and/or for timing attacks, but I didn't anything specifically about setTimeout()/setInterval() after searching a bit.

Also--loosening the accuracy of timers allows the system to optimize CPU power states and save battery. Again, not sure if that's related here.

Maybe someone else here can add more detail.

samsonradu 9 hours ago

You might be referring to the Spectre mitigation changes:

Timer precision from performance.now and other sources is reduced to 1ms (r226495)

https://webkit.org/blog/8048/what-spectre-and-meltdown-mean-...

https://trac.webkit.org/changeset/226495/webkit

  • jsheard 7 hours ago

    Although you can claw that precision back by enabling cross-origin isolation for your site, at least in Firefox and Chrome, which both quantize high res timers to 100μs in non-isolated contexts but only 5μs in isolated contexts. I'm not sure exactly what Safari does.

phire 3 hours ago

That's high precision clocks (aka Preformance.now(), with sub-millisecond resolution) not timers.

The precision of setTimeout has never been high, it kind-of maps to the OS scheduler and the OS scheduler often enforce their own minimum timeouts (Windows has defaulted to 15.625 ms resolution for a very long time, and the newer high resolution timers max out at 1ms across most operating systems)

hinkley 6 hours ago

Don’t unfocused tabs also get throttled? Otherwise we’d all be melting our computers with the 40 open tabs we have. For some of us that’s a slow day.