Bug 231169 - [Performance] Optimize RenderLayer::calculateRects
Summary: [Performance] Optimize RenderLayer::calculateRects
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: cathiechen
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-10-04 07:39 PDT by cathiechen
Modified: 2021-10-11 07:40 PDT (History)
12 users (show)

See Also:


Attachments
Patch (7.39 KB, patch)
2021-10-06 06:30 PDT, cathiechen
simon.fraser: review-
Details | Formatted Diff | Diff
screenshot-of-optimized-collectRects (597.97 KB, image/png)
2021-10-06 06:34 PDT, cathiechen
no flags Details
screenshot-of-original-collectRects (604.42 KB, image/png)
2021-10-06 06:38 PDT, cathiechen
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description cathiechen 2021-10-04 07:39:55 PDT
Optimize the performance of RenderLayer::calculateRects
Comment 1 cathiechen 2021-10-06 06:30:44 PDT
Created attachment 440356 [details]
Patch
Comment 2 cathiechen 2021-10-06 06:33:08 PDT
Here are the percentage of RenderLayer::calculateRects
* Original: 24.1%, 25.7%, 25%
* This patch: 14.9%, 14.9%, 16.0%
Comment 3 cathiechen 2021-10-06 06:34:56 PDT
Created attachment 440357 [details]
screenshot-of-optimized-collectRects
Comment 4 cathiechen 2021-10-06 06:38:46 PDT
Created attachment 440358 [details]
screenshot-of-original-collectRects
Comment 5 Simon Fraser (smfr) 2021-10-06 21:00:29 PDT
Comment on attachment 440356 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=440356&action=review

> Source/WebCore/rendering/RenderLayer.cpp:4630
> +        bool backgroundRectNotNeedRepaint = !hasBackgroundClipRect
> +            && m_repaintRectsValid
> +            && !m_repaintRects.clippedOverflowRect.intersects(backgroundRect.rect())
> +            && !m_repaintRects.outlineBoundsRect.intersects(backgroundRect.rect());

This seems wrong. Clip rect computation should be independent of cached repaint rects, and this code is not about needing repaint.
Comment 6 cathiechen 2021-10-06 21:12:12 PDT
Comment on attachment 440356 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=440356&action=review

>> Source/WebCore/rendering/RenderLayer.cpp:4630
>> +            && !m_repaintRects.outlineBoundsRect.intersects(backgroundRect.rect());
> 
> This seems wrong. Clip rect computation should be independent of cached repaint rects, and this code is not about needing repaint.

Hmm, it seems if backgroundRect or foregroundRect doesn't intersect with repaint rests, then they can't intersect with these rects: overflowClipRect, clipRect, or borderBoxRect.

The repaint rests always cover these rests, no?
Comment 7 Radar WebKit Bug Importer 2021-10-11 07:40:24 PDT
<rdar://problem/84098726>