- Notifications
You must be signed in to change notification settings - Fork2.6k
make DateTime.UtcNow 5% faster to minimize the leap second performance impact#26046
Uh oh!
There was an error while loading.Please reload this page.
Conversation
…ap second performance regression impact, related to #25728
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
gfoidl left a comment
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.
Some more micro-optimizations.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
adamsitnik commentedAug 8, 2019
Thanks for all the suggested micro-optimizations, I was able to improve the time by 0.5% |
danmoseley commentedAug 8, 2019
Given the regression from 2.2 was so much larger, my assumption is that it is not worth porting this into 3.0. |
tarekgh commentedAug 8, 2019
May be it is worth to track this for 3.1? |
danmoseley commentedAug 8, 2019
Our bar right now is a little bit lower or the same as the bar we will use for 3.1. So if we don't take it for 3.0 we would not take it for 3.1. |
tarekgh commentedAug 8, 2019
@danmosemsft thanks for the clarification. |
…e impact (dotnet/coreclr#26046)* make few methods used by DateTime.UtcNow inlinable to minimize the leap second performance regression impact, related to dotnet/coreclr#25728* apply suggested micro-optimizationsCommit migrated fromdotnet/coreclr@4450e5c
Today I've again profiled #25728 and was looking for some ways of lowering the regression.
I started with reading the source code of
FileTimeToSystemTimeandRtlpTimeToTimeFieldsmethods. TheRtlpTimeToTimeFieldstakes care of leap second support, it knows all leap seconds and knows how to handle the positive and negative ones. Copying this logic from OS to .NET makes obviously no sense, it's too complex and too expensive to maintain.By inlining some small methods that are called by
DateTime.UtcNowI was able to make it 5% faster. It ain't much, but that's all I could do.Before:
After:
And yes, all the
[MethodImpl(MethodImplOptions.AggressiveInlining)]were really needed. Moving the throws toThrowHelperwas not enough to get those methods inlined./cc @danmosemsft