New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css-grid-3][masonry] variable track sizes + dense packing has poor performance #9326
Comments
It also interacts badly if you want to allow "auto-spanning", where an element will get a span based on its width. This might be a good mode to allow, possibly even with some author control - if an image is >X% of the track width, make it span 2 instead of 1 (or a larger span, as appropriate). With variable-width tracks this is at minimum problematic for layout, and might be inherently circular (I haven't given it enough thought yet to be certain). |
@tabatkins I think auto-spanning is a separate issue. :) And an equally applicable request for Grid. |
Nah, it's part of this issue - if we do auto-spanning (and I think Masonry libraries do sometimes have this feature), then variable-size tracks are even more problematic. (And it would be equally problematic for Grid, I think.) |
@tabatkins I don't see what that has to do with dense packing. Filed as #10089 |
Back to the original issue... Agreed that having N different track sizes means dense packing would require O(N) layout passes on items added after a gap, and this would be a problem. We suggest adopting a heuristic that brings this closer to O(2) for most cases:
It's possible, but unlikely, that an item's actual shortest height would be at a middling width; and this allows us to avoid a lot of that extra work in the much more common cases where the item definitely won't fit. |
From @bfgeek in #9041 (comment)
The text was updated successfully, but these errors were encountered: