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
[feature] create setTime function #3620
Conversation
this.hours(0); | ||
/* falls through */ | ||
setTime(this, 0, 0, 0, 0); | ||
break; | ||
case 'hour': | ||
this.minutes(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like the hour
case should be this.setTime(this, this.hour(), 0, 0, 0)
, etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True! I also need to benchmark the functions setMinutes(minutes, seconds, milliseconds)
and setSeconds(seconds, milliseconds)
to see if they are even more efficient.
This could use some benchmarks. Do you mind adding one? They run via |
@aymericbouzy can you please add a simple benchmark as @icambron pointed out. Also, why stop there -- can't we use this Also when we go immutable it will be much more pronounced. |
Hi @ichernev, sorry for the delay, I've been busy and open source contribution is quite new to me. I'll look into this later today. |
It seems my code does not speed things up when ran with command Does anyone know if I can ask grunt to run the benchmark task using a different engine ? I haven't found anything about this yet in the documentation. Otherwise, I guess we can close this PR for now. |
@aymericbouzy from my cursory understanding of the matter, you can not run We've always wanted to remove this crazy case fall through, and we'll certainly like to have it in v3, so I'll merge it anyway. Just make sure to fix all cases (not just |
Thanks for this, and sorry it never got merged. I'm going to take #4338 which will supersede this one. |
It's fine, I never took the time to finish this PR anyway 🤗 |
This increases the performance of startOf / endOf by a factor of about 90 for
'day'
.NB : This is my first PR, i'm not sure what I should do, especially regarding proving my call about this performance gain. I see there is a benchmark folder, but I don't know what to do about it. I have run grunt tests successfully on my computer.