[css-grid] Cache the track sizing functions
Calculating the used sizing function for a track is not a very expensive operation, but it's not trivial either, and the track sizing algorithm needs to access sizing functions all over the place. This ends up having a performance cost, especially for spanning items. Intrinsic contributions from items that span a single track are handled 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. Therefore, to increase performance, this patch caches the used track sizing functions in the tracks themselves. This improves the auto-grid-lots-of-spanning-data perf test by 40-50%, nested-grid by 10-15%, and auto-grid-lots-of-data by 5-10%. Bug: 1021929 Change-Id: I4309629bfed28a78421889d157251643efc06b26 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1901292 Commit-Queue: Oriol Brufau <obrufau@igalia.com> Reviewed-by:Sergio Villar <svillar@igalia.com> Cr-Commit-Position: refs/heads/master@{#714511}
Showing
Please register or sign in to comment