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

Memoized renderRule #146

Merged
merged 5 commits into from
Nov 29, 2016
Merged

Memoized renderRule #146

merged 5 commits into from
Nov 29, 2016

Conversation

TheUltDev
Copy link
Contributor

@TheUltDev TheUltDev commented Nov 29, 2016

If the same style object is passed to renderRule, a previously computed className is returned. A WeakMap is used so the cache does not aggressively hold
on to referenced style objects.

I'm not sure how much real world performance increase this will have overall, but it's certainly better in theoretical tests. A 10000x loop going from 540ms~ to 2ms~.

This should work well with projects that already use an immutable flow, but then again those components shouldn't be re-rendering in the first place if the props haven't changed.

If the same style object is passed to a Prefix instance, a cached value
is returned. A WeakMap is used so the cache does not aggressively hold
on to referenced style objects.
@TheUltDev TheUltDev changed the title Memoized prefixing plugins and renderRule Memoized renderRule Nov 29, 2016
@robinweser robinweser merged commit ff82c43 into robinweser:master Nov 29, 2016
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