Skip to content

Uniform lists only need to calculate item size once#116

Closed
ltgorm wants to merge 1 commit intocaseywebdev:masterfrom
ltgorm:master
Closed

Uniform lists only need to calculate item size once#116
ltgorm wants to merge 1 commit intocaseywebdev:masterfrom
ltgorm:master

Conversation

@ltgorm
Copy link
Copy Markdown

@ltgorm ltgorm commented Jun 16, 2016

Observed that the getItemSizeAndItemsPerRow was at the top of cpu hogs when profiling for traversal of a large list. This change reduces the time spent on getting those attributes.

Observed that the getItemSizeAndItemsPerRow was at the top of cpu hogs
when profiling for traversal of a large list. This change reduces the
time spent on getting those attributes
@caseywebdev
Copy link
Copy Markdown
Owner

caseywebdev commented Jun 16, 2016

I like the idea, but this is currently a breaking change. At the moment, uniform means all elements are the same size for a given render, but not necessarily the same size for the life of the component. As such, this code would break the case for column sizes that change on window resize or elements that resize responsively. If the performance difference is that significant, it may be worth implementing this behind a new prop (strictlyUniform? staticUniform? or something) that will only ever calculate the item size and items per row once.

@caseywebdev
Copy link
Copy Markdown
Owner

Check out https://github.com/orgsync/react-list/tree/use-static-size for a backwards-compatible option

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants