W3C home > Mailing lists > Public > public-web-perf@w3.org > August 2015

Throttling requestAnimationFrame based on viewport visibility

From: Sami Kyostila <skyostil@google.com>
Date: Tue, 4 Aug 2015 15:15:35 +0100
Message-ID: <CAPuLczuULLc3YOm3M9JY0Evvz4oWdtkRtOLrhF=kCz0KaASAyw@mail.gmail.com>
To: public-web-perf@w3.org
In Blink we're considering to stop requestAnimationFrame callbacks for
documents which aren't visible[1]. This is to avoid overhead from
animations inside iframes that are outside the root viewport. Gecko
has recently implemented a similar optimization[2].

Has anyone else looked into something like this? I saw some earlier
threads about extending Page Visibility[3] to take the viewport into
account, but the scope of that change is a little larger than what
we're proposing.

The obvious compatibility risk is breaking pages that rely on an
out-of-view rAF to function. We're trying to avoid that by only
throttling cross-origin iframes -- with the hope that since there's no
synchronous way to observe rAF callbacks in those frames, sites are
less likely to rely on their timing. Does that sound reasonable?

- Sami

[1] https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/_SRHebxivJs
[2] https://bugzilla.mozilla.org/show_bug.cgi?id=1145439
[3] https://lists.w3.org/Archives/Public/public-whatwg-archive/2015Mar/0229.html
Received on Wednesday, 5 August 2015 21:40:29 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 August 2015 21:40:29 UTC