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

Optimize isDayVisible #1657

Merged
merged 1 commit into from
May 30, 2019
Merged

Optimize isDayVisible #1657

merged 1 commit into from
May 30, 2019

Conversation

lencioni
Copy link
Contributor

Cloning is a little expensive, so we want to do it as little as possible.
Here we clone the month once and keep mutating that moment object.

In my profiling this change by itself appears to reduce the amount of
time spent in this function when updating DayPickeRangeController from
~16ms to ~11ms, with almost all of the time being spent in Moment clone.

@lencioni lencioni added semver-patch: fixes/refactors/etc Anything that's not major or minor. performance labels May 30, 2019
Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

Assuming the existing tests are thorough

@coveralls
Copy link

coveralls commented May 30, 2019

Coverage Status

Coverage decreased (-0.008%) to 84.486% when pulling 5e0c8c1 on isdayvisible-opt into 9f54116 on master.

@lencioni lencioni force-pushed the isdayvisible-opt branch 3 times, most recently from 8db2c47 to 0c35128 Compare May 30, 2019 17:17
Cloning is a little expensive, so we want to do it as little as possible.
Here we clone the month once and keep mutating that moment object.

In my profiling this change by itself appears to reduce the amount of
time spent in this function when updating DayPickeRangeController from
~16ms to ~11ms, with almost all of the time being spent in Moment clone.
@lencioni lencioni merged commit 5e0c8c1 into master May 30, 2019
@lencioni lencioni deleted the isdayvisible-opt branch May 30, 2019 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance semver-patch: fixes/refactors/etc Anything that's not major or minor.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants