Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate whether we can make vsync reliable in the presence of throttling #7589

Closed
cramforce opened this issue Feb 15, 2017 · 6 comments
Closed

Comments

@cramforce
Copy link
Member

E.g. we can see to always set a timeout for like 32ms and debounce that while rAFs fire.

This may be crucial for AMP in a box. CC @lannka, @dvoytenko

#7482 is an example of how this can go wrong.

@cramforce cramforce self-assigned this Feb 15, 2017
@dvoytenko
Copy link
Contributor

Certainly possible. We clearly separate in vsync animation frames vs measure/mutate frames. The non-animation frames can be enforced to execute with the timeout. Unfortunately, that would take some performance hit to run the "just in case" timer.

@lannka
Copy link
Contributor

lannka commented Feb 16, 2017

@cramforce I understand this causes problems if rAF is not reliable. But can you explain what's special about the inabox case?

@dvoytenko
Copy link
Contributor

in-a-box iframes can and very likely will be throttled by browsers. Which mostly means that requestAnimationFrame will be either slow or won't arrive at all. Since we rely on rAF for measures/mutates, this is a significant issue.

@lannka
Copy link
Contributor

lannka commented Feb 16, 2017

It can be throttled for a "good reason" or by a bug (at least weird behavior). I think we only worry about the bug cases, right?

So we're worrying about that inabox is more likely to hit the bug (weird behavior)?

@dvoytenko
Copy link
Contributor

It's not a bug - it's a browser feature. In-a-box is likely to hit it because it's likely to be out of viewport.

@cramforce
Copy link
Member Author

I think the performance hit should be absolutely minimal

cramforce added a commit to cramforce/amphtml that referenced this issue Feb 17, 2017
Add a backup timer for non-animation vsync tasks. This ensures that non-animation tasks still eventually (timer at 2.5X normal rAF time) execute when we somehow failed to detect that we aren't visible.

Fixes ampproject#7589
@adelinamart adelinamart added this to the Pending Triage milestone Feb 23, 2017
cramforce added a commit that referenced this issue Mar 14, 2017

Add a backup timer for non-animation vsync tasks. This ensures that non-animation tasks still eventually (timer at 2.5X normal rAF time) execute when we somehow failed to detect that we aren't visible.

Fixes #7589
mrjoro pushed a commit to mrjoro/amphtml that referenced this issue Apr 28, 2017
…t#7639)



Add a backup timer for non-animation vsync tasks. This ensures that non-animation tasks still eventually (timer at 2.5X normal rAF time) execute when we somehow failed to detect that we aren't visible.

Fixes ampproject#7589
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants