Skip to content
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

Optimise CSS Grid #338

Merged
merged 12 commits into from
Jan 29, 2023
Merged

Optimise CSS Grid #338

merged 12 commits into from
Jan 29, 2023

Conversation

nicoburns
Copy link
Collaborator

@nicoburns nicoburns commented Jan 24, 2023

Objective

This targets a couple of obvious optisations of the grid algorithm:

  • Only compute child intrinsic size when needed (previously it was computing these eagerly)
  • Add early exit if only grid container measurement is required (similar to flexbox)
  • Updates caching to cache width and height measurements separately. This isn't needed for flexbox, but makes a huge difference for grid.

It also updates the grid code to use inner_node_size (Size<f32>) rather than available_grid_space (Size<f32>) as inner_node_size should always be used for resolving percentages.

@nicoburns nicoburns mentioned this pull request Jan 24, 2023
87 tasks
@alice-i-cecile
Copy link
Collaborator

These optimizations make sense to me. Do we have benchmarks for grid yet?

@nicoburns
Copy link
Collaborator Author

Do we have benchmarks for grid yet?

No, I was about to make some. But I got distracted doing the yoga ones 😂

@Weibye Weibye self-requested a review January 25, 2023 07:27
@nicoburns nicoburns force-pushed the grid/optimise branch 5 times, most recently from 33a7e88 to a26f6ad Compare January 27, 2023 01:27
@alice-i-cecile alice-i-cecile added the performance Layout go brr label Jan 27, 2023
@nicoburns nicoburns changed the title CSS Grid implementation optimisations Optimise CSS Grid Jan 29, 2023
@alice-i-cecile
Copy link
Collaborator

I'm happy to see this merged when you think it's ready :)

@nicoburns nicoburns merged commit 6ce28e1 into DioxusLabs:main Jan 29, 2023
@nicoburns nicoburns deleted the grid/optimise branch January 29, 2023 16:22
@nicoburns nicoburns added this to the 0.3 "CSS Grid" milestone Jan 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Layout go brr
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants