Closed Bug 1201548 Opened 9 years ago Closed 9 years ago

[APZ] Laggy scrolling on certain page

Categories

(Core :: Panning and Zooming, defect)

43 Branch
Unspecified
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla43
Tracking Status
firefox42 --- unaffected
firefox43 + fixed

People

(Reporter: alice0775, Assigned: botond)

References

Details

(Keywords: perf, regression)

Attachments

(2 files)

STR
1. Open https://www.reddit.com/r/canada/
   or https://www.reddit.com/r/CrappyDesign/
2. Scroll page by scrollbar(click scrollbar/scroll buttun or drag thumb) 
   or Scroll page by keyboards(up/down arrow etc)

Actual Results:
Scrolling is slow and laggy.


Pushlog:
https://hg.mozilla.org/integration/mozilla-inbound/pushloghtml?fromchange=81dd43b43784&tochange=2e4a1822a511

Regressed by:Bug 1177018


Bug 1200158 does not fix this slow/laggy scroll.
This page is also affected
 https://www.reddit.com/r/ImGoingToHellForThis/  (May contain undesirable content)
Seems to affected by the background image, if you select the option on the right "Use subreddit style", performance is better.
Thanks for the report!

The time is being spent in PaintedLayerData::AccumulateEventRegions(), scaling the hit region. Looks like the hit region can also be very complex (bug 1200158 only addressed the maybe-hit region). On the page from comment 2, it has over 800 rects.
Assignee: nobody → botond
Bug 1201548 - Simplify the hit region in AccumulateEventRegions(). r=mstange

This avoids the subsequent scaling, and the use of the region in
FindPaintedLayerFor(), being too expensive.
Attachment #8657176 - Flags: review?(mstange)
This patch simplifies the hit region in AccumulateEventRegions(), the way we did for the maybe-hit region in bug 1200158.

If we're concerned about the correctness implications of simplifying the hit region, there are a couple of alternative approaches I can envision:

  - Simplify a copy of the hit region and scale that, leaving the original
    unsimplified. This way, the only place that sees the simplified version 
    is FindPaintedLayerFor().

  - Continue to scale the unsimplified region, but only do it to the final
    accumulated region the first time FindPaintedLayerFor() needs it, not in 
    every call to AccumulateEventRegions().
(In reply to Botond Ballo [:botond] from comment #6)
>   - Simplify a copy of the hit region and scale that, leaving the original
>     unsimplified. This way, the only place that sees the simplified version 
>     is FindPaintedLayerFor().

Markus suggested a variation on this where we just use the bounds of the event regions in FindPaintedLayerFor().
Comment on attachment 8657176 [details]
MozReview Request: Bug 1201548 - When testing whether the visible rect intersects event regions in FindPaintedLayerFor(), only use the bounds of the event regions. r=mstange

Bug 1201548 - When testing whether the visible rect intersects event regions in FindPaintedLayerFor(), only use the bounds of the event regions. r=mstange

This is done for performance reasons, as the event regions can be complex.
Attachment #8657176 - Attachment description: MozReview Request: Bug 1201548 - Simplify the hit region in AccumulateEventRegions(). r=mstange → MozReview Request: Bug 1201548 - When testing whether the visible rect intersects event regions in FindPaintedLayerFor(), only use the bounds of the event regions. r=mstange
Comment on attachment 8657176 [details]
MozReview Request: Bug 1201548 - When testing whether the visible rect intersects event regions in FindPaintedLayerFor(), only use the bounds of the event regions. r=mstange

https://reviewboard.mozilla.org/r/18325/#review16427

::: layout/base/FrameLayerBuilder.cpp:2600
(Diff revision 2)
> -          visibleRegion.OrWith(data.mScaledMaybeHitRegion);
> +          if (data.mScaledHitRegionBounds.Intersects(aVisibleRect)) {
> +            break;
> +          }
> +          if (data.mScaledMaybeHitRegionBounds.Intersects(aVisibleRect)) {

Let's combine those two if statements with ||.

::: layout/base/FrameLayerBuilder.cpp:3459
(Diff revision 2)
> +  mHitRegion.SimplifyOutward(8);

I think we shouldn't simplify the hit region for correctness reasons.
Attachment #8657176 - Flags: review?(mstange)
(In reply to Markus Stange [:mstange] from comment #9)
> ::: layout/base/FrameLayerBuilder.cpp:3459
> (Diff revision 2)
> > +  mHitRegion.SimplifyOutward(8);
> 
> I think we shouldn't simplify the hit region for correctness reasons.

Ah, sorry, I meant to remove that from the patch!
Attachment #8657176 - Flags: review?(mstange)
Comment on attachment 8657176 [details]
MozReview Request: Bug 1201548 - When testing whether the visible rect intersects event regions in FindPaintedLayerFor(), only use the bounds of the event regions. r=mstange

Bug 1201548 - When testing whether the visible rect intersects event regions in FindPaintedLayerFor(), only use the bounds of the event regions. r=mstange

This is done for performance reasons, as the event regions can be complex.
Comment on attachment 8657176 [details]
MozReview Request: Bug 1201548 - When testing whether the visible rect intersects event regions in FindPaintedLayerFor(), only use the bounds of the event regions. r=mstange

https://reviewboard.mozilla.org/r/18325/#review16433
Attachment #8657176 - Flags: review?(mstange) → review+
https://hg.mozilla.org/mozilla-central/rev/065f00e9b2fd
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: