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

Drastically improve perf with memoize #39

Merged
merged 1 commit into from Oct 17, 2013
Merged

Conversation

caseywebdev
Copy link
Contributor

I was using moment by itself for a project and then added moment-timezone and noticed a huge performance degradation. After some profiling and digging I noticed that many of the moment-timezone functions could and should be memoized. After applying this patch to my own project, performance returned to how it was pre-moment-timezone. The test speed is also very telling...

before

>> 103487 assertions passed (63010ms)

Done, without errors.

after

>> 103487 assertions passed (18811ms)

Done, without errors.

Furthermore, this speed difference is even more apparent in real world use cases were most computing is done in a single, relevant timezone.

Thanks for all the work put into this, timezones are a nightmare...

@mrwade
Copy link

mrwade commented Oct 10, 2013

👍

@timrwood
Copy link
Member

Looks good!

I knew we would have to add memoization at some point as these methods have quite a bit of computation involved.

Thanks for tackling this.

timrwood added a commit that referenced this pull request Oct 17, 2013
Drastically improve perf with memoize
@timrwood timrwood merged commit 26763da into moment:master Oct 17, 2013
@caseywebdev
Copy link
Contributor Author

🎆

jlfwong added a commit to UWFlow/rmc that referenced this pull request Nov 18, 2013
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.

None yet

3 participants