-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
<chrono>: Performance: consider GetSystemTimeAsFileTime instead of GetSystemTimePreciseAsFileTime #624
Comments
@StephanTLavavej wasn't there an internal version of this bug? |
Not to my knowledge - I intentionally used Precise as non-Precise is so coarse-grained. I wasn't aware that Precise was slower; my understanding was that QPC was very fast. Can you quantify what "way faster" is? |
@StephanTLavavej Maybe I'm remembering DevCom-184829 which was filed against the UCRT |
Oh yeah, the VM interaction. |
Simple performance test:
Result on my system:
I believe that results would vary. It all depends on performance of
This is also true, so I'm not sure if 10 times performance difference advocates this change. |
Note that the same way (It is actually my production case; I needed fast and steady clock. Luckily, implementing Clock based on |
While it could, I think it would be better to keep using QPC for |
We talked about this in our weekly meeting, and we believe that making a runtime behavior change here would be destabilizing. We suggest writing a clock powered by |
Currently
std::chrono::system_clock::now()
isGetSystemTimePreciseAsFileTime()
on Vista+Consider just using
GetSystemTimeAsFileTime()
, as it is way faster, as it does not useQueryPerformanceCounter()
uderneath.If user wants resolution, they would call
high_resolution_clock
, which issteady_clock
, and it directly callsQueryPerformanceCounter()
.Potentially breaking change, but not ABI-breaking.
The text was updated successfully, but these errors were encountered: