Hacker News new | ask | show | jobs
by avolcano 2228 days ago
I'm not actually sure requestAnimationFrame() in a browser ever gets you >60 fps. At that point, honestly, you'd probably need an independent render thread (doing some degree of interpolation) and stick to a 60fps logic tick. Which you can theoretically do in JS using web workers, though I know message-passing incurs some serious overhead in that case.
2 comments

Depends on the browser, but at least in Firefox and Chrome it should match actual refresh rate if the graphics stack plays properly. (i.e. I don't know if it does if GPU acceleration doesn't fully work)
requestAnimationFrame absolutely supports higher than 60 FPS. You can also do all rendering off the main thread with OffscreenCanvas, though you can certainly hit 144 Hz or higher without doing that.
Currently OffscreenCanvas is only supported on Chrome. :\
And the new Edge? Of browsers from major vendors at least, I thought Edge was worth mentioning since it recently overtook Firefox in desktop market share.
Nope, only Chrome based engines.