Skip to content

performance optimisations #12

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

Merged
merged 2 commits into from
Aug 19, 2016
Merged

performance optimisations #12

merged 2 commits into from
Aug 19, 2016

Conversation

vectorsize
Copy link

I did some performance optimizations to your themeable function, since I was having issues inside a scroll event.
Basically avoid looping through keys that are not meant to belong in the original theme, and using Object.assign which seems to be faster.

All tests are passing.

@javivelasco
Copy link
Owner

Great! Thanks!

@javivelasco javivelasco merged commit 3a4bbc3 into javivelasco:master Aug 19, 2016
style[key] && theme[key].indexOf(style[key]) === -1
? `${style[key]} ${theme[key]}`
: theme[key] || style[key]
})), style)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now passed style is mutated in reduce so a theme which is in context gets mutated too.

Copy link
Author

@vectorsize vectorsize Aug 19, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops you are right @raveclassic, will fix that, hopefully it doesnt slow down much, thanks for keeping an eye on this!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did a quick fix, still performs better, here:
https://github.com/javivelasco/react-css-themr/pull/13/files

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, honestly I did not dig deep before merging but I wanted to give a better look before releasing. Thanks for keeping an eye on it @raveclassic!

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.

3 participants