New issue
Advanced search Search tips

Issue 818772 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Mar 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac
Pri: 2
Type: Bug

Blocking:
issue 417782



Sign in to add a comment

[root layer scrolls] blink_perf.events / hit-test-lots-of-layers regressed

Project Member Reported by pdr@chromium.org, Mar 5 2018

Issue description

This regressed by ~10% and has not recovered:
https://chromeperf.appspot.com/report?sid=3b390b53e032c8309416e313abe4c7044e8b7228c2899def331fee8495b5562a&start_rev=510316&end_rev=539180

This does reproduce on desktop. I did some basic profiling and I think this is partially due to PaintLayer::HitTest where PaintLayerClipper is used. Without RLS, PaintLayerClipper::CalculateRectsWithGeometryMapper can use a fast-path to update the layer_bounds but with RLS, GeometryMapper::SourceToDestinationProjection must be used.
 

Comment 1 by pdr@chromium.org, Mar 5 2018

Owner: pdr@chromium.org
Status: Assigned (was: Untriaged)
I talked to Chris and we can try a targeted 2d optimization in GeometryMapper::SourceToDestinationProjection. I'll look into this.

Comment 2 by pdr@chromium.org, Mar 5 2018

Description: Show this description

Comment 3 by pdr@chromium.org, Mar 7 2018

This benchmark has 5000 layers and does 1000 hit tests per frame, so the code is largely a microbenchmark of PaintLayerClipper::CalculateRectsWithGeometryMapper (via PaintLayer::HitTest). There's a !rls fast-path that avoids GeometryMapper::SourceToDestinationProjection and removing that drops the regression from 19% to 15%. If we make an RLS-compatible fastpath, the regression only drops to 9.5% because we still need to do a little extra work for RLS (a few comparisons and a few LayoutRect moves). I don't think it makes sense to microoptimize this microbenchmark to avoid GeometryMapper::SourceToDestinationProjection unless we can see it on real (or more representative) content.

I'm going to look at the remaining 4% regression that isn't explained by calling GeometryMapper::SourceToDestinationProjection and see if there's anything there that we might be able to fix.

Comment 4 by pdr@chromium.org, Mar 8 2018

I found that the linux-rel bot is not updating. Lets use the following graphs for this bug:
https://chromeperf.appspot.com/report?sid=69cbbe7d2e2ade46ee2f3e8ad999728923259e32282d2d4f90769c297a12e7f5&start_rev=524947&end_rev=541841

"Check LayoutBox hit test clip optimization before hit testing any phase" / https://chromium-review.googlesource.com/c/chromium/src/+/953378 / git position #541659 just landed which should improve this graph.

Comment 5 by pdr@chromium.org, Mar 9 2018

This is looking pretty good on the graphs. I'd like to let it bake for another few days to ensure the perf results are good, then merge to M66.

I have another patch ready to go (https://chromium-review.googlesource.com/c/chromium/src/+/957363) with similar results. With these two simple patches together, the hit testing regression should be completely gone (and more).

Comment 6 by pdr@chromium.org, Mar 12 2018

Labels: Merge-Request-66
The upcoming patch turned out to be too complex to merge. I'd like to merge just this performance patch: https://crbug.com/dd5e972c015c14842c39eaae7b76a74e59b9416a
Please add affected OSs.
Project Member

Comment 8 by bugdroid1@chromium.org, Mar 12 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/b3e06524f7eb66c456c7b63fdf6df5d98fe59deb

commit b3e06524f7eb66c456c7b63fdf6df5d98fe59deb
Author: Philip Rogers <pdr@chromium.org>
Date: Mon Mar 12 17:32:02 2018

HitTestLocation should store a LayoutRect instead of an IntRect

A large amount of time hit testing is spent converting LayoutRects
to IntRects for the purposes of intersecting. This patch updates
HitTestLocation's bounding_box_ rect to be a LayoutRect which is
consistent with the LayoutPoint point and reduces conversions.

With this patch, blink_perf.events.hit-test-lots-of-layers improves
by between 2% and 5%.

Bug:  818772 
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: Ic3bc3b846b89e392b7b9f29a6affb42a5be81152
Reviewed-on: https://chromium-review.googlesource.com/957363
Reviewed-by: Chris Harrelson <chrishtr@chromium.org>
Commit-Queue: Philip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542529}
[modify] https://crrev.com/b3e06524f7eb66c456c7b63fdf6df5d98fe59deb/third_party/WebKit/Source/core/exported/WebPluginContainerImpl.cpp
[modify] https://crrev.com/b3e06524f7eb66c456c7b63fdf6df5d98fe59deb/third_party/WebKit/Source/core/exported/WebPluginContainerTest.cpp
[modify] https://crrev.com/b3e06524f7eb66c456c7b63fdf6df5d98fe59deb/third_party/WebKit/Source/core/input/EventHandler.cpp
[modify] https://crrev.com/b3e06524f7eb66c456c7b63fdf6df5d98fe59deb/third_party/WebKit/Source/core/input/EventHandler.h
[modify] https://crrev.com/b3e06524f7eb66c456c7b63fdf6df5d98fe59deb/third_party/WebKit/Source/core/input/PointerEventManager.cpp
[modify] https://crrev.com/b3e06524f7eb66c456c7b63fdf6df5d98fe59deb/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp
[modify] https://crrev.com/b3e06524f7eb66c456c7b63fdf6df5d98fe59deb/third_party/WebKit/Source/core/layout/HitTestLocation.cpp
[modify] https://crrev.com/b3e06524f7eb66c456c7b63fdf6df5d98fe59deb/third_party/WebKit/Source/core/layout/HitTestLocation.h
[modify] https://crrev.com/b3e06524f7eb66c456c7b63fdf6df5d98fe59deb/third_party/WebKit/Source/core/layout/HitTestResult.cpp
[modify] https://crrev.com/b3e06524f7eb66c456c7b63fdf6df5d98fe59deb/third_party/WebKit/Source/core/layout/HitTestResult.h
[modify] https://crrev.com/b3e06524f7eb66c456c7b63fdf6df5d98fe59deb/third_party/WebKit/Source/core/layout/LayoutInlineTest.cpp
[modify] https://crrev.com/b3e06524f7eb66c456c7b63fdf6df5d98fe59deb/third_party/WebKit/Source/core/layout/line/EllipsisBox.cpp
[modify] https://crrev.com/b3e06524f7eb66c456c7b63fdf6df5d98fe59deb/third_party/WebKit/Source/core/layout/line/LineBoxList.cpp
[modify] https://crrev.com/b3e06524f7eb66c456c7b63fdf6df5d98fe59deb/third_party/WebKit/Source/core/page/TouchDisambiguation.cpp
[modify] https://crrev.com/b3e06524f7eb66c456c7b63fdf6df5d98fe59deb/third_party/WebKit/Source/core/paint/PaintLayer.cpp
[modify] https://crrev.com/b3e06524f7eb66c456c7b63fdf6df5d98fe59deb/third_party/WebKit/Source/core/testing/Internals.cpp
[modify] https://crrev.com/b3e06524f7eb66c456c7b63fdf6df5d98fe59deb/third_party/WebKit/Source/core/testing/data/plugin_container.html
[modify] https://crrev.com/b3e06524f7eb66c456c7b63fdf6df5d98fe59deb/third_party/WebKit/Source/platform/geometry/LayoutRectOutsets.h

Comment 9 by pdr@chromium.org, Mar 12 2018

Labels: OS-Android OS-Chrome OS-Linux OS-Mac OS-Windows

Comment 10 by pdr@chromium.org, Mar 12 2018

Note that this merge request is only for https://crbug.com/dd5e972c015c14842c39eaae7b76a74e59b9416a. I don't want to merge the patch that just landed in comment #8.
Project Member

Comment 11 by sheriffbot@chromium.org, Mar 13 2018

Labels: -Merge-Request-66 Merge-Approved-66 Hotlist-Merge-Approved
Your change meets the bar and is auto-approved for M66. Please go ahead and merge the CL to branch 3359 manually. Please contact milestone owner if you have questions.
Owners: cmasso@(Android), cmasso@(iOS), josafat@(ChromeOS), abdulsyed@(Desktop)

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 12 by cmasso@google.com, Mar 13 2018

Please merge this change as soon as possible
Project Member

Comment 14 by bugdroid1@chromium.org, Mar 14 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/debbb8554587f0e15b88484d94917ff76025c706

commit debbb8554587f0e15b88484d94917ff76025c706
Author: Philip Rogers <pdr@chromium.org>
Date: Wed Mar 14 00:12:49 2018

[CI] Add LayoutRect::IntersectsInclusively for edge-inclusive intersection

This patch adds a bool check version of LayoutRect::InclusiveIntersect.

Bug:  818772 
Change-Id: I0c844628c6b79359e5b88c2bf54b4a6600479d46
Reviewed-on: https://chromium-review.googlesource.com/958411
Reviewed-by: Stefan Zager <szager@chromium.org>
Commit-Queue: Philip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542958}
[modify] https://crrev.com/debbb8554587f0e15b88484d94917ff76025c706/third_party/WebKit/Source/platform/geometry/LayoutRect.cpp
[modify] https://crrev.com/debbb8554587f0e15b88484d94917ff76025c706/third_party/WebKit/Source/platform/geometry/LayoutRect.h
[modify] https://crrev.com/debbb8554587f0e15b88484d94917ff76025c706/third_party/WebKit/Source/platform/geometry/LayoutRectTest.cpp

Project Member

Comment 15 by bugdroid1@chromium.org, Mar 14 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/0954e0672f34d88424ead8763c12ddfd66ce4a26

commit 0954e0672f34d88424ead8763c12ddfd66ce4a26
Author: Philip Rogers <pdr@chromium.org>
Date: Wed Mar 14 00:21:25 2018

[CI] Document FloatQuad and FloatRoundedRect inclusive intersections

The following intersection functions are edge-inclusive:
FloatQuad::IntersectsRect
FloatQuad::IntersectsCircle
FloatQuad::IntersectsEllipse
FloatRoundedRect::IntersectsQuad

This is different from FloatRect::Intersects and LayoutRect::Intersects
which are edge-exclusive. This patch adds a comment above each of these
functions specifying that they are edge-inclusive, and adds tests.

Bug:  818772 
Change-Id: I7c1212a08e5e8874fb9679c5a676f91a97d3fce7
Reviewed-on: https://chromium-review.googlesource.com/960841
Reviewed-by: Stefan Zager <szager@chromium.org>
Commit-Queue: Philip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542961}
[modify] https://crrev.com/0954e0672f34d88424ead8763c12ddfd66ce4a26/third_party/WebKit/Source/platform/geometry/FloatQuad.cpp
[modify] https://crrev.com/0954e0672f34d88424ead8763c12ddfd66ce4a26/third_party/WebKit/Source/platform/geometry/FloatQuad.h
[modify] https://crrev.com/0954e0672f34d88424ead8763c12ddfd66ce4a26/third_party/WebKit/Source/platform/geometry/FloatQuadTest.cpp
[modify] https://crrev.com/0954e0672f34d88424ead8763c12ddfd66ce4a26/third_party/WebKit/Source/platform/geometry/FloatRoundedRect.h
[modify] https://crrev.com/0954e0672f34d88424ead8763c12ddfd66ce4a26/third_party/WebKit/Source/platform/geometry/FloatRoundedRectTest.cpp

Project Member

Comment 16 by bugdroid1@chromium.org, Mar 16 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/870c262728c7c2c5423d553a83de9a239634ee86

commit 870c262728c7c2c5423d553a83de9a239634ee86
Author: Philip Rogers <pdr@chromium.org>
Date: Fri Mar 16 20:17:04 2018

[CI] Inline FloatSize::IsZero and FloatRoundedRect::IsZero

blink_perf.events.hit-test-lots-of-layers is a microbenchmark of
hit PaintLayer::HitTestLayer which uses GeometryMapper. One of the
hottest functions is GeometryMapper::LocalToClipRectInternal which
creates a lot of FloatClipRects that check FloatRoundedRect::IsZero
in their constructor. By inlining the IsZero functions, we get a
3%-4% improvement on the entire benchmark.

Bug:  818772 
Change-Id: I0fb4c02152b799399aa19d521ba91ed46e326c3c
Reviewed-on: https://chromium-review.googlesource.com/966797
Reviewed-by: Chris Harrelson <chrishtr@chromium.org>
Commit-Queue: Philip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543802}
[modify] https://crrev.com/870c262728c7c2c5423d553a83de9a239634ee86/third_party/WebKit/Source/platform/geometry/FloatRoundedRect.cpp
[modify] https://crrev.com/870c262728c7c2c5423d553a83de9a239634ee86/third_party/WebKit/Source/platform/geometry/FloatRoundedRect.h
[modify] https://crrev.com/870c262728c7c2c5423d553a83de9a239634ee86/third_party/WebKit/Source/platform/geometry/FloatSize.cpp
[modify] https://crrev.com/870c262728c7c2c5423d553a83de9a239634ee86/third_party/WebKit/Source/platform/geometry/FloatSize.h

Project Member

Comment 17 by sheriffbot@chromium.org, Mar 19 2018

This issue has been approved for a merge. Please merge the fix to any appropriate branches as soon as possible!

If all merges have been completed, please remove any remaining Merge-Approved labels from this issue.

Thanks for your time! To disable nags, add the Disable-Nags label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 18 by pdr@chromium.org, Mar 19 2018

Labels: -Merge-Approved-66 Merge-Merged

Sign in to add a comment