AutoHotkey Benchmarks

Contents

Control Group

BenchmarkCodeAHK v1.0.95.00AHK v1.1.10.00
Blank Run
(None)
0.0010870.000716

1,000,000 iterations each

Assignment

BenchmarkCodeAHK v1.0.95.00AHK v1.1.10.00
Classic
Variable = Lorem ipsum dolor sit amet
0.0013640.000983
Classic with variable
Variable = Lorem ipsum %OtherVariable% dolor sit amet
0.0016330.001126
Expression
Variable := "Lorem ipsum dolor sit amet"
0.0018410.001213
Expression with variable
Variable := "Lorem ipsum" . OtherVariable . " dolor sit amet"
0.0020500.001556

1,000,000 iterations each

Comparison

BenchmarkCodeAHK v1.0.95.00AHK v1.1.10.00
Classic If statement
If Variable = abcdef
 Return
0.0019500.001434
Expression If statement
If (Variable = "abcdef")
 Return
0.0019470.001491
List comparison
If Variable In abcdef
 Return
0.0017180.001510
Ternary
% (Variable = "abcdef") ? "" : ""
0.0021080.001595
Classic If between
If Variable Between 123 And 124
 Return
0.0025440.001705
Expression If between
If (Variable >= 123 && Variable <= 124)
 Return
0.0026090.001845

1,000,000 iterations each

String Searching

BenchmarkCodeAHK v1.0.95.00AHK v1.1.10.00
String search statement
IfInString, Variable, abcdef
 Return
0.0023270.001904
List search statement
If Variable Contains abcdef
 Return
0.0027820.002227
String get position command
StringGetPos, Temp1, Variable, abcdef
0.0036300.002219
In string function
InStr(Variable,"abcdef")
0.0033940.002393

1,000,000 iterations each

Regular Expressions

BenchmarkCodeAHK v1.0.95.00AHK v1.1.10.00
Match function
RegExMatch(Variable,"S)ab.*?.f$")
0.0062220.002544
Replace function
RegExReplace(Variable,"S)ab.*?.f$","$0")
0.0072110.002593

500,000 iterations each

String Manipulation

BenchmarkCodeAHK v1.0.95.00AHK v1.1.10.00
Substring function
SubStr(Variable,2,3)
0.0028780.002883
String middle command
StringMid, Temp1, Variable, 2, 3
0.0033750.003064
String trim command
StringTrimLeft, Temp1, Variable, 1
0.0029360.002624
String replace command
StringReplace, Temp1, Variable, c, c, All
0.0038100.003594

1,000,000 iterations each

String Operations

BenchmarkCodeAHK v1.0.95.00AHK v1.1.10.00
String length function
StrLen(Variable)
0.0039430.002551
String length command
StringLen, Temp1, Variable
0.0037870.002966
String split command
StringSplit, Temp, Variable, c
0.0049630.002887
Case conversion
StringUpper, Temp1, Variable
0.0038550.003837

1,000,000 iterations each

Files

BenchmarkCodeAHK v1.0.95.00AHK v1.1.10.00
File attributes and exists function
FileExist(A_ScriptFullPath)
0.0939500.002930
If file exists
IfExist, %A_ScriptFullPath%
 Return
0.1057910.003042
Get size
FileGetSize, Temp1,%A_ScriptFullPath%
0.1183610.004121
Read file
FileRead, Temp1, *m100 %A_ScriptFullPath%
0.1678990.003481
Read file line
FileReadLine, Temp1, %A_ScriptFullPath%, 2
0.1653240.098674
Append to file
FileAppend, c, %A_Temp%\Temp.txt
0.7589980.095710
Copy file
FileCopy, %A_Temp%\Temp.txt, %A_Temp%\Temp1.txt, 1
1.5669060.108829
Move file
FileMove, %A_Temp%\Temp.txt, %A_Temp%\Temp.txt, 1
1.4775770.110798
Filesystem loop
Loop, %A_ScriptFullPath%
 Return
0.1373730.106387
File reading loop
Loop, Read, %A_ScriptFullPath%
 Return
0.1443961.285957

5,000 iterations each

Control Flow

BenchmarkCodeAHK v1.0.95.00AHK v1.1.10.00
Normal loop
Loop, 1
{
 
}
0.0047394.587631
While loop
While, (A_Index = 1)
{
 
}
0.0047814.809858
Parsing loop
Loop, Parse, Variable, ,
{
 
} Return
0.0066660.148427
Blank subroutine call
Gosub, BlankLabel
0.0046000.136903
Blank function call
BlankFunction()
0.0054660.003966

1,000,000 iterations each

Environment Variables

BenchmarkCodeAHK v1.0.95.00AHK v1.1.10.00
Set environment variable
EnvSet, EnvVar, abcdeg
0.0083760.005057
Get environment variable
EnvGet, Temp1, EnvVar
0.0060290.004824

500,000 iterations each

Keyboard and mouse

BenchmarkCodeAHK v1.0.95.00AHK v1.1.10.00
Get mouse position
MouseGetPos, Temp1, Temp2
0.0100960.004828
Move mouse
MouseMove, 0, 0, 0, R
0.0625770.004245

5,000 iterations each

Dynamic Variables

BenchmarkCodeAHK v1.0.95.00AHK v1.1.10.00
Dynamic variable access
% %Variable%
0.0062760.009393
Dynamic variable assignment
%Variable% = abcdeg
0.0060690.004947

1000000 iterations each

System Information

FieldValue
AutoHotkey VersionAutoHotkey v1.0.95.00 Unicode (x86)
OS NameMicrosoft Windows 7 Enterprise
OS Version6.1.7601 Service Pack 1 Build 7601
OS ConfigurationStandalone Workstation
OS Build TypeMultiprocessor Free
System ManufacturerDell Inc.
System ModelLatitude D620
System TypeX86-based PC
Processor(s)1 Processor(s) Installed.,[01]: x86 Family 6 Model 14 Stepping 8 GenuineIntel ~1319 Mhz
BIOS VersionDell Inc. A04, 8/28/2006
Total Physical Memory3,062 MB
Available Physical Memory1,496 MB
Virtual Memory: Max Size6,123 MB
Virtual Memory: Available4,334 MB