4 ms·
'Why is QueryPerformanceCounter running at 10 MHz on my Lenovo P51 laptop?' Wild guess, Spectre mitigation ?
by bartwe 8y ago
'Why is QueryPerformanceCounter running at 10 MHz on my Lenovo P51 laptop?' Wild guess, Spectre mitigation ?
- olliej 8y agoHuh, you may be right - in JSC and webkit the timer precision is deliberately limited for precisely that reason.
- brucedawson 8y agoNative code that wants more precision can use rdtsc. JavaScript in the browser should have its timer precision reduced, to prevent timing attacks, but that should be done by the browser, not the OS. The reduced precision isn't what really bothers me though - it's the cost. My measurements suggest that QPC is about 25x as expensive as rdtsc on this laptop - expensive enough to make calling it too frequently a problem. This article explains some of the reasons why rdtsc might not be used to implement QPC, and I'm curious as to which one applies, and how machines this applies to: https://docs.microsoft.com/en-us/windows/desktop/SysInfo/acquiring-high-resolution-time-stamps#direct-tsc-usage https://docs.microsoft.com/en-us/windows/desktop/SysInfo/acq...