Bug 231169

Summary: [Performance] Optimize RenderLayer::calculateRects
Product: WebKit Reporter: cathiechen <cathiechen>
Component: Layout and RenderingAssignee: cathiechen <cathiechen>
Status: NEW    
Severity: Normal CC: bfulgham, changseok, esprehn+autocc, ews-watchlist, fred.wang, glenn, kondapallykalyan, pdr, rbuis, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=229802
Attachments:
Description Flags
Patch
simon.fraser: review-
screenshot-of-optimized-collectRects
none
screenshot-of-original-collectRects none

cathiechen
Reported 2021-10-04 07:39:55 PDT
Optimize the performance of RenderLayer::calculateRects
Attachments
Patch (7.39 KB, patch)
2021-10-06 06:30 PDT, cathiechen
simon.fraser: review-
screenshot-of-optimized-collectRects (597.97 KB, image/png)
2021-10-06 06:34 PDT, cathiechen
no flags
screenshot-of-original-collectRects (604.42 KB, image/png)
2021-10-06 06:38 PDT, cathiechen
no flags
cathiechen
Comment 1 2021-10-06 06:30:44 PDT
cathiechen
Comment 2 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%
cathiechen
Comment 3 2021-10-06 06:34:56 PDT
Created attachment 440357 [details] screenshot-of-optimized-collectRects
cathiechen
Comment 4 2021-10-06 06:38:46 PDT
Created attachment 440358 [details] screenshot-of-original-collectRects
Simon Fraser (smfr)
Comment 5 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.
cathiechen
Comment 6 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?
Radar WebKit Bug Importer
Comment 7 2021-10-11 07:40:24 PDT
Note You need to log in before you can comment on or make changes to this bug.