3 ms·
I'm mostly working on a desktop computer so I don't care that much about energy consumption, however I do notice that a lot of websites have some timer going of
by magicalhippo 3y ago
I'm mostly working on a desktop computer so I don't care that much about energy consumption, however I do notice that a lot of websites have some timer going off at very high frequency, as part of some framework or whatnot.
Personally I don't see why Firefox can't just stop JavaScript execution on tabs that aren't visible after say 5 seconds, unless the user has enabled background execution.
- jakub_g 3y agoAll browsers already heavily throttle js timers execution in background tabs. You also have specific apis like requestAnimationFrame to decouple UI timers from non-UI timers like setInterval. Stopping it entirely and then suddenly restarting on foreground would be probably too much of a breaking change for the websites' developers. I mean, I guess it could be possible but would require properly thinking it through. Some browsers aggressively freeze background tabs but AFAIR they do full reload on unfreeze. The breakage area of shipping that kind of change into the web ecosystem of a major browser is huge.