Code: Select all
t:=ahktime()
{
f:=[]
loop 100000
f.push(A_Index)
for i,n in f
a:=i*n
}
MsgBox % "Running time:`t" ahktime(t) "`nPause time:`t" ahktime(223.1,0)
;Compare pause time
loop 60
s.= A_Index " : " ahktime(A_Index,0) "`t"
MsgBox % s
ahkTime(s:=0,i:=6){
static r:=(DllCall("QueryPerformanceFrequency",Int64P,r),r)
DllCall("QueryPerformanceCounter",Int64P,n)
if !i
{
s>15?sleep(((s-5)//15)*15):"",p:=s/1000*r,n2:=n,c:=A_IsCritical,Critical("on")
while ((n2-n)<p)
DllCall("QueryPerformanceCounter", "Int64P", n2)
Return Critical(c),Round((n2-n)/r, 8)
}
Return (s ? Round((n-s)/r, i) : n)
}