Issue metadata
Sign in to add a comment
|
[css-grid] Grid painting code always paints the whole grid |
||||||||||||||||||||||
Issue descriptionWe have some code in GridPainter which tries to determine the portion of the grid being shown in the viewport and selects only the visible items to be painted. However it relies in some data structure called the layout visual rect. It turns out that it's always the size of the whole grid meaning that we always send the list of all the items to the painting code. We knew this was working at some point because we had bugs in the past about grid items not being painted due to too aggressive optimizations.
,
Jun 18 2018
,
Jun 18 2018
So I've been doing a quick check. If I use a small grid 100px by 100px, the local_visual_rect is 800x600. However if I use a big grid 2000px by 2000px, the rect is 2000x2000. If I go bigger like 10000px by 100000px, the rect is 4800x4600. So only in this last case our optimization is doing some useful work.
,
Sep 20
So I have been doing some tests under perf_tests/paint. I wrote a test of a grid of 500 rows and 500 columns and one item per cell, where each column and row has a breath of 5px (the total size is 2500px x 2500px). In this case the optimization is not useful at all, as the CullRect is 4800x4600 and we're going to paint all the items anyway, actually the "optimization" is adding an overhead. With current code the test takes an average of 5239ms while removing the optimization it takes an average of 4439ms. I also checked a big grid of 500x500 with breaths of 20px (size 10000 px x 10000 px). In this case the optimization should be saving us from paining a lot of items instead of painting 250000 items we'll be painting only ~62500 items. Here the results of current code were almost the same than without the optimization, an average of 1730ms and without the optimization 1737ms. So I believe we should get rid of the "optimization" that is no longer doing anything useful and simplify our code.
,
Sep 20
For future reference, there's a thread in blink-dev about this topic: https://groups.google.com/a/chromium.org/d/msgid/blink-dev/407a210a-cb90-7817-da48-62b532fb821e%40igalia.com
,
Sep 21
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/71265f961b86780b8abd297295f2b9b936f4ac59 commit 71265f961b86780b8abd297295f2b9b936f4ac59 Author: Manuel Rego Casasnovas <rego@igalia.com> Date: Fri Sep 21 08:34:48 2018 [css-grid] Remove painting "optimization" Since a while ago the CullRect we get in GridPainter::PaintChildren() is really big matching the size of the grid if it's smaller than 4800x4600 pixels. For that reason the painting optimization we have is not doing anything useful if the grid is smaller than that size, as all the grid items are painted anyway. Even it's adding some overhead in some cases making things slower. For that reason we're getting rid of the optimization which allows us to simplify the grid layout code and rely on more common painting code. No new test as it's covered by existent ones. BUG= 853654 Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel Change-Id: Ida3cf7cc081b8671ea10a300891b0825f76258bd Reviewed-on: https://chromium-review.googlesource.com/1235998 Reviewed-by: Sergio Villar <svillar@igalia.com> Reviewed-by: Philip Rogers <pdr@chromium.org> Commit-Queue: Manuel Rego <rego@igalia.com> Cr-Commit-Position: refs/heads/master@{#593120} [modify] https://crrev.com/71265f961b86780b8abd297295f2b9b936f4ac59/third_party/blink/renderer/core/layout/layout_flexible_box.cc [modify] https://crrev.com/71265f961b86780b8abd297295f2b9b936f4ac59/third_party/blink/renderer/core/layout/layout_grid.cc [modify] https://crrev.com/71265f961b86780b8abd297295f2b9b936f4ac59/third_party/blink/renderer/core/layout/layout_grid.h [modify] https://crrev.com/71265f961b86780b8abd297295f2b9b936f4ac59/third_party/blink/renderer/core/paint/BUILD.gn [modify] https://crrev.com/71265f961b86780b8abd297295f2b9b936f4ac59/third_party/blink/renderer/core/paint/block_painter.cc [modify] https://crrev.com/71265f961b86780b8abd297295f2b9b936f4ac59/third_party/blink/renderer/core/paint/block_painter.h [delete] https://crrev.com/a047f6f2084cffef50a8ce143babb9934f864c7b/third_party/blink/renderer/core/paint/grid_painter.cc [delete] https://crrev.com/a047f6f2084cffef50a8ce143babb9934f864c7b/third_party/blink/renderer/core/paint/grid_painter.h
,
Sep 21
|
|||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||
Comment 1 by svil...@igalia.com
, Jun 18 2018