Hi!
I forgot to mention this issue, thank you for bringing it up.
Background throttling is disabled whenever something that is
considered real time, like audio, or could potentially time out, like
web sockets, is present on he page, including iframes.
To both prove to myself that these mechanisms work, as well as the
entire feature, I've created a visualiser:
https://farre.github.io/web-tools/load/
The UI is a bit messy to say the least, but if you don't need to
configure anything you can just hit 'Run test' and make sure to allow
the pop up. After that a uniform load of 50% will be generated, spread
out over 10 timeouts during one second. This will happen in the tab
with the UI, so don't switch back to that from the pop-up, because
then throttling will be canceled. The pop-up runs this load for each
of the unthrottlers (stuff that makes budget throttling impossible),
and half-way during that period (typically 40 seconds) it adds the
unthrottler. I've added some screenshots! The first shows how it looks
like with no unthrottler and with a RTCPeerConnection present. Here we
see how the timeout starts out at the once per second background
throttling, then goes down to the circa 1% background throttling due
to budget constraints, and then back again to the 5% level. The second
screenshot shows what happens when audio starts in the background, and
here we see that we start at 5%, go down to 1%, but when audio starts
playing we get the load that we requested completely unthrottled!
I've tried it out with Edge and Chrome as well, and with it you can
see how throttling works there. On caveat though, both Chrome and Edge
only throttle daisy chained timeouts, and the default settings for the
test is to fire off 10 timeouts, that are spread out without overlap.
To get it to work in Chrome and Edge, change 'Slices#' to 1 and
'Period' to 100, which will still get you a 50% load, but with daisy
chained timeouts, one every 100 ms.
Remember to flip the pref if you want to try the visualiser out! It's
dom.timeout.enable_budget_timer_throttling, and I've been running with
it on for weeks without problems :)
Cheers,
Andreas
On Thu, Oct 5, 2017 at 5:39 PM, Soledad Penadés <
so...@mozilla.com> wrote:
> Hello!
>
> This sounds like a cool feature, thanks for that! However, as you said, it's
> easier to get this wrong. I wonder if you have tested this with Web Audio
> scenarios in mind. We had a similar issue a while ago where web audio
> scheduled with setTimeouts (a common practice) would time out when eager
> optimisations were in place:
>
>
https://bugzilla.mozilla.org/show_bug.cgi?id=1375119
>
> sole
> --
>
http://soledadpenades.com
>