Possible A_LoopFileLongPath bug
Posted: 16 Jan 2018, 18:43
I will ask in advance for forgiveness if this is not actually a bug, and should have been put elsewhere.... I was really unsure where to put it.
Apparently, the use of A_LoopFileLongPath in File Loops is Orders of Magnitude slower than using other File Loop variables...
Here is the test code I used, and the results:
As written, using the LoopFileFullPath added to the working directory, the results were pretty good, I think. 45 seconds to complete.
Results:
Number of Files Found: 1281076
Elapsed Time: 0:45
Number of Files Found: 1281076
Elapsed Time: 0:45
Number of Files Found: 1281076
Elapsed Time: 0:45
However, the same program substituting A_LoopFileLongPath were incredibly slow:
Results:
Number of Files Found: 1281076
Elapsed Time: 0:57:38
Number of Files Found: 1281076
Elapsed Time: 0:57:34
Number of Files Found: 1281076
Elapsed Time: 0:57:32
My system drive is an SSD bottlenecked by a SATA 2 Connection:
Windows 7 Ultimate
The script was run from my "scratch drive" (R:) which is a RAM Drive.
The AutoHotKey Directory is in my Program Files Directory Located on Drive F: which is a different SSD
The version of Hotkey is 1.1.27.04
The computer was idle except for the test scripts during testing.
If I have missed listing a parameter you need, I will happily supply it, but these are the only ones I can think of that you would find relevant.
Apparently, the use of A_LoopFileLongPath in File Loops is Orders of Magnitude slower than using other File Loop variables...
Here is the test code I used, and the results:
Code: Select all
SetBatchLines -1
Source:="D:" ; My System Root Directory
SetWorkingDir, % Source
Target_File:="R:\Test.txt"
counter=
StartTime:=A_TickCount
loop, files, *.*, FR
{
counter++
tempvar:=Source . A_LoopFileFullPath
}
gosub, Stopwatch ;Calculates difference in TickCount, and formats the result
FileAppend, Number of Files Found:`t %counter%`n, %Target_File%
FileAppend, Elapsed Time:`t%ElapsedTime%, %Target_File%
Run, %Target_File%
ExitApp
As written, using the LoopFileFullPath added to the working directory, the results were pretty good, I think. 45 seconds to complete.
Results:
Number of Files Found: 1281076
Elapsed Time: 0:45
Number of Files Found: 1281076
Elapsed Time: 0:45
Number of Files Found: 1281076
Elapsed Time: 0:45
However, the same program substituting A_LoopFileLongPath were incredibly slow:
Code: Select all
SetBatchLines -1
Source:="D:" ; My System Root
SetWorkingDir, % Source
Target_File:="R:\Test.txt"
counter=
StartTime:=A_TickCount
loop, files, *.*, FR
{
counter++
tempvar:=A_LoopFileLongPath
}
gosub, Stopwatch ;Calculates difference in TickCount, and formats the result
FileAppend, Number of Files Found:`t %counter%`n, %Target_File%
FileAppend, Elapsed Time:`t%ElapsedTime%, %Target_File%
Run, %Target_File%
ExitApp
Number of Files Found: 1281076
Elapsed Time: 0:57:38
Number of Files Found: 1281076
Elapsed Time: 0:57:34
Number of Files Found: 1281076
Elapsed Time: 0:57:32
My system drive is an SSD bottlenecked by a SATA 2 Connection:
Windows 7 Ultimate
The script was run from my "scratch drive" (R:) which is a RAM Drive.
The AutoHotKey Directory is in my Program Files Directory Located on Drive F: which is a different SSD
The version of Hotkey is 1.1.27.04
The computer was idle except for the test scripts during testing.
If I have missed listing a parameter you need, I will happily supply it, but these are the only ones I can think of that you would find relevant.