Here's a comparison:
And it gets exponentially worse the more files there are, for example, looping through 'C:\Windows\SysWOW64'...
A_LoopFilePath: 13,494
A_LoopFileFullPath: 2,534,414
Files: 2,855
Performance drop: 187 times
I am using the system directory as an example, but this happens everywhere.
Code for AHK1:
Code: Select all
;AHK1
DllCall("QueryPerformanceCounter","Int64*",StartTime)
Loop Files,% A_WinDir "\*.*"
PokeTheVariable:=A_LoopFilePath
DllCall("QueryPerformanceCounter","Int64*",EndTime)
DllCall("QueryPerformanceCounter","Int64*",StartTime1)
Loop Files,% A_WinDir "\*.*"
PokeTheVariable:=A_LoopFileFullPath
DllCall("QueryPerformanceCounter","Int64*",EndTime2)
Msgbox % "AHK1`nA_LoopFilePath: `t" EndTime-StartTime "`nA_LoopFileFullPath: `t" EndTime2-StartTime1
Code: Select all
;AHK2
DllCall("QueryPerformanceCounter","Int64*",StartTime)
Loop Files,A_WinDir "\*.*"
PokeTheVariable:=A_LoopFilePath
DllCall("QueryPerformanceCounter","Int64*",EndTime)
DllCall("QueryPerformanceCounter","Int64*",StartTime1)
Loop Files,A_WinDir "\*.*"
PokeTheVariable:=A_LoopFileFullPath
DllCall("QueryPerformanceCounter","Int64*",EndTime2)
Msgbox "AHK2`nA_LoopFilePath: `t" EndTime-StartTime "`nA_LoopFileFullPath: `t" EndTime2-StartTime1