RESOLVED FIXED 207852
[css-grid] Improve performance of track sizing algorithm for spanning items
https://bugs.webkit.org/show_bug.cgi?id=207852
Summary [css-grid] Improve performance of track sizing algorithm for spanning items
Oriol Brufau
Reported 2020-02-17 12:24:47 PST
The grid track sizing algorithm handles intrinsic contributions from items that span a single track in a simpler way than when the span is greater than 1. In the former case, sizeTrackToFitNonSpanningItem only calculates the track sizing function of each track once per each item in that track. But in the latter case we not only calculate the track sizing function of multiple tracks per item, we also repeat this 5 times in order to handle the various TrackSizeComputationPhase. Calculating the used track sizing function from the raw one is not a very expensive operation when done once, but repeating it so many times has a performance impact. In Chromium I added a auto-grid-lots-of-spanning-data.html perf test. The changes that I plan to do will improve the performance of that test by 40% in WebKit.
Attachments
Patch (14.67 KB, patch)
2020-02-17 12:34 PST, Oriol Brufau
no flags
Patch (14.67 KB, patch)
2020-02-17 14:46 PST, Oriol Brufau
no flags
Patch (14.86 KB, patch)
2020-02-18 05:21 PST, Oriol Brufau
no flags
Oriol Brufau
Comment 1 2020-02-17 12:34:42 PST
Oriol Brufau
Comment 2 2020-02-17 14:46:27 PST
Javier Fernandez
Comment 3 2020-02-18 02:05:51 PST
Comment on attachment 390984 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=390984&action=review > Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp:247 > + const GridTrackSize& trackSize = tracks(m_direction)[trackPosition].cachedTrackSize(); We can use 'auto' type here. > Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp:271 > + const GridTrackSize& trackSize = trackList[trackPosition].cachedTrackSize(); Ditto > Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp:450 > + const GridTrackSize& trackSize = track.cachedTrackSize(); Ditto > Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp:573 > + // We cannot use tracks(direction)[trackPosition].cachedTrackSize() It's not needed to wrap comments like this. > Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp:634 > + const GridTrackSize& trackSize = rawGridTrackSize(direction, trackPosition); Use auto here > Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp:729 > + const GridTrackSize& trackSize = allTracks[trackIndex].cachedTrackSize(); Ditto > Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp:825 > + const GridTrackSize& trackSize = allTracks[trackPosition].cachedTrackSize(); Ditto
Oriol Brufau
Comment 4 2020-02-18 05:21:31 PST
WebKit Commit Bot
Comment 5 2020-02-18 06:47:52 PST
Comment on attachment 391040 [details] Patch Clearing flags on attachment: 391040 Committed r256826: <https://trac.webkit.org/changeset/256826>
WebKit Commit Bot
Comment 6 2020-02-18 06:47:53 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 7 2020-02-18 06:48:15 PST
Note You need to log in before you can comment on or make changes to this bug.