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

Improve performance of layout queries and requestAnimationFrame #15816

Merged
merged 2 commits into from Mar 5, 2017

Commits on Mar 3, 2017

  1. layout: Replace ConstructionResult::swap_out() with get()

    It only actually swaps out in nonincremental mode (which isn't suitable
    for real world use), so the name is confusing.
    pcwalton authored and nox committed Mar 3, 2017
  2. script: Use a timer when rAF is used for non-animation purposes

    After this patch, when the page calls `requestAnimationFrame()` too many
    times in the row without actually mutating the DOM, further calls to
    `rAF` will actually perform the moral equivalent of `setTimeout(16)`.
    This saves a lot of CPU time compared to actually waiting for the
    vertical blanking interval, because waiting for that requires us to draw
    the page.
    
    Reduces CPU usage drastically on nytimes.com, which has a perpetual
    `requestAnimationFrame()` loop that checks whether ads are in view.
    pcwalton authored and nox committed Mar 3, 2017
You can’t perform that action at this time.