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

moment-timezone performance issues #44

Closed
louischatriot opened this issue Nov 13, 2013 · 8 comments
Closed

moment-timezone performance issues #44

louischatriot opened this issue Nov 13, 2013 · 8 comments
Milestone

Comments

@louischatriot
Copy link

Hello,

Thanks for this library it really rocks. One issue I have with it though is performance. When using only moment and manipuilating dates, it is very fast. When adding timezone support it becomes much slower:

var m = moment(new Date());
m.add('days', 1);
// Takes ~0.2ms

m = moment(new Date()).tz("America/Los_Angeles");
m.add('days', 1);
// Takes ~20ms

Is it something you can and are planning to solve, or is it due to having to do a lot of stuff on top of the native Date object and there is not much you can do about it?

@jlfwong
Copy link

jlfwong commented Nov 17, 2013

Agree that this library is super awesome, but do wish it was faster

image

See: http://jsperf.com/momentjstz

@icambron
Copy link
Member

I don't think it's made it into a release yet, so have a look at #39 - it should help a lot here.

@jlfwong
Copy link

jlfwong commented Nov 17, 2013

@icambron Sweeeet. That made a huge difference! Thanks @caseywebdev!

@caseywebdev
Copy link
Contributor

👍 ran into the same thing, memoization helped a lot.

@icambron
Copy link
Member

I'm going to leave this ticket open until the release is out.

@dickfickling
Copy link

Would it be possible to make a release with the change from #39 as 0.0.4? It's a major improvement, and I'd love to be able to get moment-timezone from npm rather than building from source.

@gjohnson gjohnson mentioned this issue May 5, 2014
@timrwood
Copy link
Member

See #82 as well.

The speed improvements with the rewrite are pretty significant. These are the times for running all the unit tests.

original     63s
memoized     18s
precomputed  7s

@timrwood timrwood added this to the 0.1.0 milestone Jun 18, 2014
@timrwood
Copy link
Member

This is released in 0.1.0.

See the performance gains here. http://jsperf.com/moment-timezone-0-1-0/3

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

No branches or pull requests

6 participants