This is the result of my testing:
1 0.001020
2 0.002012
3 0.003022
4 0.004028
5 0.005412
6 0.006024
7 0.007371
8 0.008039
9 0.009366
10 0.010514
11 0.011150
12 0.012660
13 0.013447
14 0.014487
15 0.015591
16 0.016617
17 0.017301
18 0.018379
19 0.019212
20 0.020619
21 0.021420
22 0.022159
23 0.023147
24 0.024528
25 0.025076
26 0.026495
27 0.027124
28 0.028146
29 0.029166
30 0.030034
31 0.031186
32 0.032491
33 0.033499
34 0.034575
35 0.035232
36 0.036287
37 0.037404
38 0.038395
39 0.039829
40 0.040187
41 0.041769
42 0.042465
43 0.043688
44 0.044529
45 0.045268
46 0.046269
47 0.047393
48 0.048645
49 0.049588
50 0.050129
Code: Select all
st := ""
loop 50
{
DllCall('QueryPerformanceCounter', 'Int64P', &g_time1 := 0)
sleep2(A_Index)
DllCall('QueryPerformanceCounter', 'Int64P', &g_time2 := 0)
st .= A_Index "`t" Round((g_time2 - g_time1) / 10000000, 6) "`n"
}
MsgBox st
sleep2(ti) {
if (ht := DllCall("CreateWaitableTimerExW", "ptr", 0, "ptr", 0, "uint", 3, "uint", 0x1F0003, "uptr"))
&& DllCall("SetWaitableTimer", "uptr", ht, "uint64*", ti * -10000, "int", 0, "ptr", 0, "ptr", 0, "int", 0)
DllCall("WaitForSingleObject", "uptr", ht, "UInt", 0xFFFFFFFF), DllCall('CloseHandle', "uptr", ht)
}