(SOLVED) [AHK2] A_LoopFileFullPath is over 10 times slower than in AHK1

Report problems with documented functionality
User avatar
HakitoJin
Posts: 17
Joined: 02 Oct 2016, 17:20

(SOLVED) [AHK2] A_LoopFileFullPath is over 10 times slower than in AHK1

27 Aug 2018, 05:14

Edit : { Not a bug, A_LoopFileLongPath was changed to A_LoopFileFullPath in AHK2... }


Here's a comparison:
Image

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 for AHK2:

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
Last edited by HakitoJin on 27 Aug 2018, 09:30, edited 4 times in total.
swagfag
Posts: 3086
Joined: 11 Jan 2017, 17:59

Re: [AHK2] A_LoopFileFullPath is over 10 times slower than in AHK1

27 Aug 2018, 06:52

on v1 A_LoopFilePath and A_LoopFileFullPath both call the same function.
on v2 A_LoopFilePath calls A_LoopFilePath same as v1, but A_LoopFileFullPath calls the v1 equivalent of A_LoopFileLongPath, which is a different function entirely
the benchmark measures different functions
guest3456
Posts: 2795
Joined: 09 Oct 2013, 10:31

Re: [AHK2] A_LoopFileFullPath is over 10 times slower than in AHK1

27 Aug 2018, 06:57

https://autohotkey.com/v2/v2-changes.htm
Renamed:

A_LoopFileFullPath -> A_LoopFilePath (returns a relative path if the Loop's parameter was relative, so "full path" was misleading)
A_LoopFileLongPath -> A_LoopFileFullPath


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 12 guests