Skip to content

Avoid some moment object creation in modifier generation#1662

Merged
lencioni merged 1 commit intomasterfrom
memolast
May 31, 2019
Merged

Avoid some moment object creation in modifier generation#1662
lencioni merged 1 commit intomasterfrom
memolast

Conversation

@lencioni
Copy link
Copy Markdown
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

@lencioni lencioni requested review from ljharb, majapw and nkinser May 30, 2019 23:09
@coveralls
Copy link
Copy Markdown

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.

3 participants