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

Fix caching for flexbox columns #556

Merged

Conversation

nicoburns
Copy link
Collaborator

@nicoburns nicoburns commented Oct 9, 2023

Objective

Fixes a perf issue due to cache-thrashing that occurs with Flexbox columns.

Changes made

Increased caches slots per node from 7 to 9, and updated slot-assingment algorithm to make use of those extra slots. specifically, MinContent and MaxContent/Definite sizes are now cached separately in both axis.

Context

Found when investigating the following issues:

Potential future improvements

  • Optimise cache size by taking advantage of invariants encoded by the cache slot assignment algorithm. For example, slot 8 is only used if known_dimensions are (None, None) and available_space is (MinContent, MinContent). So storing the value of those inputs as cache keys is unnecessary for that slot.
  • Improve benchmarks. It has become apparent that there are a lot of cases our current benchmarks don't cover: columns, all-auto sized nodes, flex wrapping, measure functions (in particular: measure functions that return non-constant sizes and slow measure functions), etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working performance Layout go brr
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants