Bug 123989 - [meta][CSS Grid Layout] Speed up track layout
Summary: [meta][CSS Grid Layout] Speed up track layout
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
Keywords: BlinkMergeCandidate
Depends on: 123995 124039 124408
Blocks: 133304
  Show dependency treegraph
Reported: 2013-11-07 04:48 PST by Sergio Villar Senin
Modified: 2014-05-27 07:37 PDT (History)
7 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Sergio Villar Senin 2013-11-07 04:48:50 PST
This involves merging the following patches from Blink:

* [CSS Grid Layout] Speed up content sized track layout
    This change narrows down the relayout condition in
    RenderGrid::logicalContentHeightForChild to only
    percentage children: as they are the only lengths that
    depends on the containing block's override. We
    unfortunately can't use percentHeightDescendants as
    it's not populated yet. This code can probably be
    simplified further down but it's a good start.
    This greatly speeds up the new performance test, moving
    from 25 runs/sec to 91 runs/sec.
    Review URL: https://chromiumcodereview.appspot.com/22983004

* [CSS Grid Layout] Cache track breadth min/max content types
    Profiling shows we repeatedly hit the GridLength isLength() method and
    the is{Min,Max}Content() methods of the actual Length object. By
    caching this information, which won't change until we set again the
    grid lengths, we can improve the auto-grid-lots-of-data.html test by
    about a 6% (39 runs/s -> 41.5 runs/s).
    Review URL: https://codereview.chromium.org/28053003
* [CSS Grid] Do not grow grid tracks when the growth factor has 0 length
    RenderGrid::distributeSpaceToTracks is by far the hottest method in
    the auto-grid-lots-of-data.html performance test. By reducing useless
    "growing" of grid tracks when the growth factor is zero we can improve
    the test time by 3.55% (422 runs/s -> 437 runs/s).
    Review URL: https://codereview.chromium.org/48573002
Comment 1 Sergio Villar Senin 2013-11-07 07:59:35 PST
Added a dependency because the third patch needs the changes from bug 123994.
Comment 2 Sergio Villar Senin 2013-11-07 08:23:34 PST
Actually I'm going to transform this in a meta bug as there are several potential optimizations that will be better handled in different bugs.
Comment 3 Sergio Villar Senin 2013-11-07 08:26:22 PST
Some other potential merges:

    Remove an extra relayout for non-percent logical height grid items

    The only reason for a grid item to force a relayout after a grid
    area's logical height change is if it has a percentage height. In
    all other cases, this would cause an unneeded relayout. Note that
    changing the logical width still forces a relayout as the situation
    is not that simple.

    This improves auto-grid-lots-of-data.html from 94 runs/s to 226
    runs/s as we avoid a relayout in layoutGridItems for every grid


    Review URL: https://chromiumcodereview.appspot.com/23694023


Content-sized resolution should only happen on content-sized tracks

    The current code would always try to run the content sized
    algorithm regardless of whether this was needed. On top of
    it, it would iterate over ALL grid items, even if only a
    small set of the tracks were content-sized.

    This change stores of which tracks are content-sized and
    use the internal grid to only iterate over these tracks.

    On a Z620, this speeds up
    PerformanceTests/Layout/fixed-grid-lots-of-data.html from
    about 550 runs / sec to 830 runs / sec.


    Review URL: https://chromiumcodereview.appspot.com/22867006
Comment 4 Sergio Villar Senin 2013-11-07 09:17:48 PST
And also:

    CSS Grid Layout] Avoid preferred logical widths' recomputations
    The code runs the content-sized track sizing algorithm all the time,
    which forces a layout even when the track is not content-sized. This
    change makes us bail out if we know we don't need to run the
    algorithm. Note that it will not help content sized grid tracks.
    This speeds up PerformanceTests/Layout/fixed-grid-lots-of-data.html
    from ~28.5 run/s to ~585 run/s by avoiding a lot of unneeded layouts.
    The baselines change comes from triggering less layouts, which changes
    the frame rects between 2 subsequent layouts thus changing the repaint
    Review URL: https://chromiumcodereview.appspot.com/22949002
Comment 5 Sergio Villar Senin 2013-11-18 08:44:39 PST
Added bug 123995 to the list of dependencies
Comment 6 Sergio Villar Senin 2013-12-03 03:24:57 PST
I'm closing this as all the dependencies have landed.