jsmreese / moment-duration-format

Format function plugin for the Moment Duration object.
MIT License
968 stars 120 forks source link

50% perf hit from 1.3.0 to 2.2.2 #107

Open icetbr opened 6 years ago

icetbr commented 6 years ago

Hi, have a simple benchmark test that runs a slow function in my code 20 times. This is the average time:

lib 1.3.0: 169ms lib 2.2.2: 267ms

Duration.format is called 5397 times.

Just thought I would let you guys know.

jsmreese commented 6 years ago

This is true. Version 2 does a lot of extra work in the name of accuracy. JavaScript isn't exactly good at math.

You have a good point. Version 2 seems to have its bugs ironed out now, so it's a good time to look for performance improvements.

Just thought I would let you guys know.

This made me smile. There's no you guys... just me. 😄

icetbr commented 6 years ago

Oh, that is so sad to hear :-) Well, thanks for your efforts, keep it up the good work

ticky commented 5 years ago

Now that #122 is landed, I’d love to know what the perf numbers are looking like here!