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

performance considerations #3

Closed
threepointone opened this issue Jul 22, 2016 · 5 comments
Closed

performance considerations #3

threepointone opened this issue Jul 22, 2016 · 5 comments

Comments

@threepointone
Copy link
Owner

parent issue/scratchpad for all things perf

things that can affect performance

  • many rules
  • many unused rules
  • hashing
  • large ranges of rules in short period of time (like animations, or app startup)

things to lookout for

  • selector performance
  • cpu cycles
  • memory / gc pressure
  • redraws/reflows

things that can help

@threepointone
Copy link
Owner Author

Got a huge win by using 'insertRule' in production, anywhere from 10-2000x.

@JakeCoxon
Copy link

Any ideas on recovering unused rules? I like to write css as a function of state like state => style({ color: state.color }) but this has potential to create a bunch of unused rules.

My idea is to keep track of what elements are actually using the rules and discard those rules if they aren't. We can do this with mutation observer, it would keep this library from being react specific which could be nice. But it may be pretty shitty for performance so needs some tests. I can look into it if you want to head in this direction?

@threepointone
Copy link
Owner Author

threepointone commented Jul 28, 2016

There's an experimental keyed(key, style) that reuses rules with the same key, that might help. That said, I thought a bunch about removing unused rules, and it didn't make much sense to me for css (and is really hard to implement right, especially when using in shared environments).
Some more thoughts here #1 (comment) and I'll be validating some of those theories here #13

@threepointone
Copy link
Owner Author

perf is 'mostly solved' over the last few releases. closing.

@eladmoshe
Copy link

@threepointone as a newcomer, I am really interested to see some info what to expect performance wise (compared to plain CSS). I see there is a placeholder for that in the docs but it appears to be empty. Some benchmarking would be even better.
As migrating existing project to Glamor is a big investment, it would be reassuring to know what to expect.

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

No branches or pull requests

3 participants