Grid: single track span optimisation#343
Closed
nicoburns wants to merge 0 commit intoDioxusLabs:mainfrom
Closed
Conversation
bb7be1c to
611084c
Compare
alice-i-cecile
approved these changes
Feb 3, 2023
auto-merge was automatically disabled
February 3, 2023 01:31
Pull request was closed
611084c to
ab747b8
Compare
Collaborator
Author
|
This was accidentally included in #344. So it has been merged, just not via this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
Improve performance of CSS Grid context sizing.
Changes made
Implements Section 11.4.2 of the CSS Grid spc "Size tracks to fit non-spanning items". This is a specialised variant of Section 11.4.3 "Increase sizes to accommodate spanning items crossing content-sized tracks" that defines an optimised intrinsic track sizing algorithm for the case where an item spans exactly 1 track (the most common case).
Performance results
A 50% performance improvement for the "deep" benchmarks (which are the most realistic). More modest 5-15% improvements on the "wide" and "superdeep" benchmarks. This brings our 6500 node random track benchmark down to ~8ms. This is still slower than flexbox at 10000 nodes (~5ms) but isn't that far off (roughly 2x), and from what I've read we should expect grid to be a little slower than flexbox. It's also a lot better than the ~540ms that this benchmark was taking when it was first created, or even the ~24ms it was taking this morning.
As of this PR, I'm considering performance good enough for release.