Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Existing Intervention to add--setTimeout/setInterval are aligned/clamped to 1 second in many browsers #5

Closed
toddreifsteck opened this issue Feb 17, 2016 · 7 comments

Comments

@toddreifsteck
Copy link

Safari, Chrome and Firefox all currently have some form of background tab timer coalescing that seems to align/clamp to 1 second. (Firefox/Chrome's behavior differ a bit and it may be useful to web Interop to align.)

@skyostil
Copy link

Chrome on Android additionally completely stops suspends timers in background tabs after 5 minutes: https://code.google.com/p/chromium/codesearch#chromium/src/components/scheduler/renderer/renderer_scheduler_impl.h&rcl=1455769844&l=217

@ojanvafai
Copy link
Member

We clearly need to spec the 1 second thing and the full suspending that we do on android. So adding the needs spec label.

The other thing Chrome is considering is to start doing the full suspension on desktop, like we do on Android. We're considering doing this for cases where we would have killed the background tab due to memory constraints, i.e. suspend tasks in that tab and purge any transient memory (e.g. layout tree, etc).

@skyostil
Copy link

skyostil commented Sep 6, 2016

We're now also looking at doing a bit more adaptive throttling for background tabs in Chrome on top of this 1 Hz alignment. The reason is that a misbehaving background tab can still end up using a lot of CPU either by having lots of timers or a long running timer. The general idea is outlined here: https://docs.google.com/document/d/1vCUeGfr2xzZ67SFt2yZjNeaIcXGp2Td6KHN7bI02ySo/edit#

@brheenan
Copy link

brheenan commented Nov 3, 2016

This is shipped in Edge as well now (as of EdgeHTML14). The clamping to 1Hz in background tabs, not anything more intensive.

@bryanmcquade
Copy link

Additional context on the original change in Chrome:
https://blog.chromium.org/2011/03/getting-smoother-animated-web-content.html

@wanderview
Copy link

Note, firefox throttles timers to a minimum 1 second delay in the background, but we don't align them. See:

https://bugzilla.mozilla.org/show_bug.cgi?id=1284368

@johannhof
Copy link
Member

(As noted in #72, we intend to archive this repository and are thus triaging and resolving all open issues)

I filed whatwg/html#7941 for further standardization and linked to this issue for context.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants