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.
Created attachment 390960 [details] Patch
Created attachment 390984 [details] Patch
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
Created attachment 391040 [details] Patch
Comment on attachment 391040 [details] Patch Clearing flags on attachment: 391040 Committed r256826: <https://trac.webkit.org/changeset/256826>
All reviewed patches have been landed. Closing bug.
<rdar://problem/59548279>