News for hackers. Stuff that matters.
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?

Re:Tab throttling and more performance improvements in Chrom... by rasz on Wednesday November 18, 2020 @08:26PM (#25145164)