This is a question I wouldn't ask on S.O because no one would know what I was talking about. Here goes:
I'm messing around building a CPU pixel blitter, for fun. Here's a tiny demo:
https://thestrikeagency.com/ktest/dist/
I ran into lots of problems when I tried to run these draws on a setTimer, so I built a simple [actual, delta-based] timer.
If you watch it in Chrome, you'll see draws take ~5ms for the first 3 seconds, then throttle to 15ms for the next 50-60 seconds. Then all by themselves if you leave it running that long, they decide to go back to 5ms. If you background the window, it stays throttled for 50 seconds after you put the window in front.
I was aware of Event throttling and aware setTimer throttling. But this is running off Promises finished at the end of each iteration. (The code is unobfuscated if you want to look). Is Chrome throttling async/await ... based on user interaction?
Once Chrome decides I've kept it open for a full minute, it pegs at 60fps and doesn't drop again.
Does anyone know: What is this alchemy, and how can I prevent Chrome from throttling it for seconds 3 to 60 ?
[EDIT] VERY importantly: If you reload the tab, the throttling does not happen! It starts fast and stays fast after a reload. It only throttles if you close the tab and open it anew. Which is even weirder. Chrome remembers not to throttle a script after you reload it?!
Check out the code of this Lissajous Curve Demo https://ericfortis.github.io/lissajous/
This SO answer explains the difference: https://stackoverflow.com/a/38709924/529725