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

Avoid some moment object creation in modifier generation #1662

Merged
merged 1 commit into from
May 31, 2019
Merged

Conversation

lencioni
Copy link
Contributor

Creating these moment objects is expensive, and we do it a lot in
addModifier/deleteModifier, which get called a lot whenever these day
pickers update. For this particular one, we almost always want the same
value every time it is called, so we can memoize the previous value, a
la reselect.

This reduces the amount of time spent generating modifiers from ~46ms to
~32ms.

Before:
image

After:
image

@coveralls
Copy link

coveralls commented May 30, 2019

Coverage Status

Coverage increased (+0.03%) to 84.631% when pulling 0e2ed9a on memolast into e3b9c8d on master.

Creating these moment objects is expensive, and we do it a lot in
addModifier/deleteModifier, which get called a lot whenever these day
pickers update. For this particular one, we almost always want the same
value every time it is called, so we can memoize the previous value, a
la reselect.

This reduces the amount of time spent generating modifiers from ~46ms to
~32ms.
@lencioni lencioni merged commit 0e2ed9a into master May 31, 2019
@lencioni lencioni deleted the memolast branch May 31, 2019 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants