Re:Tab throttling and more performance improvements in Chrom...
by Cactus2018 on Tuesday November 17, 2020 @03:19PM
(#25129220)
> We investigated how background tabs use system resources and found that JavaScript Timers represent >40% of the work in background tabs. ... Beginning in M87, we’re throttling JavaScript timer wake-ups in background tabs to once per minute. This reduces CPU usage by up to 5x, and extends battery life up to 1.25 hours in our internal testing. We’ve done this without sacrificing the background features that users care about, like playing music and getting notifications.
[ Parent
| on HN ]
Re:Tab throttling and more performance improvements in Chrom...
by brundolf on Tuesday November 17, 2020 @05:18PM
(#25130678)
...what in the world are all of those background timers doing? Polling for things like element visibility or something? I rarely have use for timers, especially now that CSS animations are available everywhere
Re:Tab throttling and more performance improvements in Chrom...
by chhamilton on Wednesday November 18, 2020 @09:49AM
(#25137329)
(Chromium dev here)
Yes, lots of sites are written with tight setInterval/setTimeout loops, checking for modifications to the DOM, visibility, doing animations, etc. In most cases there are modern web APIs that do these things for you that don't require polling (rAF, MutationObserver, IntersectionObserver, etc). Throttling is mostly about reducing the impact of these sites. We are not trying to penalize well-written sites, and if you have valid use cases that you feel are being unfairly penalized we're more than happy to accept feedback!
Re:Tab throttling and more performance improvements in Chrom...
by brundolf on Wednesday November 18, 2020 @12:26PM
(#25139528)
Thanks for the added context! That makes sense. I've debugged one or two hastily-assembled marketing sites in my time and I've seen some atrocious practices along these lines. At one time you could charitably write it off as maximizing browser support, but much of it can't really be explained that way anymore. It's a shame that sites like these drag down the web experience as a whole.
Re:Tab throttling and more performance improvements in Chrom...
by rasz on Tuesday November 17, 2020 @10:08PM
(#25132753)
things like this:
var tid = setInterval(function() {
var bef = new Date().getTime();
debugger ;var af = new Date().getTime();
if (af - bef > 100) {
clearInterval(tid);
window.location.href = "/";
}
}, 100);
Re:Tab throttling and more performance improvements in Chrom...
by brundolf on Wednesday November 18, 2020 @01:11AM
(#25133705)
So, what... as soon as you open your dev tools you go into debugging mode in this random spot?
Is this something people actually do? Especially on production?