Open Bug 1302839 Opened 9 years ago Updated 2 years ago

[css-grid] optimize calculating grid-gap contribution to a particular span length

Categories

(Core :: Layout: Grid, defect, P3)

defect

Tracking

()

People

(Reporter: MatsPalmgren_bugz, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: perf)

It occurred to me that this: + nscoord space = aAvailableSpace - mGridGap * (aRange.Extent() - 1); which we added in bug 1299133, can be optimized by moving the latter term one level up instead. This code is in CollectGrowable, which is called for each item, but the calling code does so in span order, i.e. all items with span=2 is called in sequence, then span=3 etc, so we can calculate "mGridGap * (aRange.Extent() - 1)" once for each span value rather than for each item. And reuse the same value for all the CollectGrowable calls there. And probably also subtract it directly before: if (space <= 0) { continue; } so that we don't even need to call CollectGrowable in that case.
Severity: normal → S3
Component: Layout → Layout: Grid
You need to log in before you can comment on or make changes to this bug.