AutoHotkey Benchmarks

Contents

Control Group

BenchmarkCodeAHK v1.0.48.05AHK v1.1.08.01
Blank Run
(None)
0.0003400.000360

1,000,000 iterations each

Assignment

BenchmarkCodeAHK v1.0.48.05AHK v1.1.08.01
Classic
Variable = Lorem ipsum dolor sit amet
0.0004730.000472
Classic with variable
Variable = Lorem ipsum %OtherVariable% dolor sit amet
0.0005050.000558
Expression
Variable := "Lorem ipsum dolor sit amet"
0.0005620.000603
Expression with variable
Variable := "Lorem ipsum" . OtherVariable . " dolor sit amet"
0.0006750.000764
Expression explicit concatenation
Variable := "Lorem ipsum" . " dolor sit amet"
0.0006440.000739
Expression implicit concatenation
Variable := "Lorem ipsum" " dolor sit amet"
0.0006660.000795

1,000,000 iterations each

Comparison

BenchmarkCodeAHK v1.0.48.05AHK v1.1.08.01
Classic If statement
If Variable = abcdef
 Return
0.0006620.000815
Expression If statement
If (Variable = "abcdef")
 Return
0.0006540.000839
List comparison
If Variable In abcdef
 Return
0.0007260.000915
Ternary
% (Variable = "abcdef") ? "" : ""
0.0007730.000983
Classic If between
If Variable Between 123 And 124
 Return
0.0007710.001020
Expression If between
If (Variable >= 123 && Variable <= 124)
 Return
0.0009020.001119

1,000,000 iterations each

String Searching

BenchmarkCodeAHK v1.0.48.05AHK v1.1.08.01
String search statement
IfInString, Variable, abcdef
 Return
0.0008760.001154
List search statement
If Variable Contains abcdef
 Return
0.0009220.001196
String get position command
StringGetPos, Temp1, Variable, abcdef
0.0009640.001258
In string function
InStr(Variable,"abcdef")
0.0009460.001277

1,000,000 iterations each

Regular Expressions

BenchmarkCodeAHK v1.0.48.05AHK v1.1.08.01
Match function
RegExMatch(Variable,"S)ab.*?.f$")
0.0010830.001442
Replace function
RegExReplace(Variable,"S)ab.*?.f$","$0")
0.0011260.001580
Static match
RegExMatch(Variable,"S)abcdef")
0.0011240.001488
Static replace
RegExReplace(Variable,"c","c")
0.0017100.001763

500,000 iterations each

String Manipulation

BenchmarkCodeAHK v1.0.48.05AHK v1.1.08.01
Substring function
SubStr(Variable,2,3)
0.0010380.001436
String middle command
StringMid, Temp1, Variable, 2, 3
0.0011840.001643
String trim command
StringTrimLeft, Temp1, Variable, 1
0.0011130.001583
String replace command
StringReplace, Temp1, Variable, c, c, All
0.0015050.001846

1,000,000 iterations each

String Operations

BenchmarkCodeAHK v1.0.48.05AHK v1.1.08.01
String length function
StrLen(Variable)
0.0010880.001596
String length command
StringLen, Temp1, Variable
0.0011830.001672
String split command
StringSplit, Temp, Variable, c
0.0015960.002130
Case conversion
StringUpper, Temp1, Variable
0.0014200.001915

1,000,000 iterations each

Files

BenchmarkCodeAHK v1.0.48.05AHK v1.1.08.01
File attributes and exists function
FileExist(A_ScriptFullPath)
0.0132910.007830
If file exists
IfExist, %A_ScriptFullPath%
 Return
0.0143430.006953
Get size
FileGetSize, Temp1,%A_ScriptFullPath%
0.0307770.029339
Read file
FileRead, Temp1, *m100 %A_ScriptFullPath%
0.0374040.035044
Read file line
FileReadLine, Temp1, %A_ScriptFullPath%, 2
0.0533700.038042
Append to file
FileAppend, c, %A_Temp%\Temp.txt
1.1704711.436660
Copy file
FileCopy, %A_Temp%\Temp.txt, %A_Temp%\Temp1.txt, 1
1.0002030.941176
Move file
FileMove, %A_Temp%\Temp.txt, %A_Temp%\Temp.txt, 1
0.7550710.728750
Filesystem loop
Loop, %A_ScriptFullPath%
 Return
0.0252720.022870
File reading loop
Loop, Read, %A_ScriptFullPath%
 Return
0.0465100.037617

5,000 iterations each

Control Flow

BenchmarkCodeAHK v1.0.48.05AHK v1.1.08.01
Normal loop
Loop, 1
{
 
}
0.0015380.002280
While loop
While, (A_Index = 1)
{
 
}
0.0016780.002401
Parsing loop
Loop, Parse, Variable, ,
{
 
}
0.0019090.002582
Blank subroutine call
Gosub, BlankLabel
0.0016030.002317
Blank function call
BlankFunction()
0.0016490.002430

1,000,000 iterations each

Environment Variables

BenchmarkCodeAHK v1.0.48.05AHK v1.1.08.01
Set environment variable
EnvSet, EnvVar, abcdeg
0.0038240.004967
Get environment variable
EnvGet, Temp1, EnvVar
0.0023400.002613

500,000 iterations each

Keyboard and mouse

BenchmarkCodeAHK v1.0.48.05AHK v1.1.08.01
Get mouse position
MouseGetPos, Temp1, Temp2
0.0050140.005788
Move mouse
MouseMove, 0, 0, 0, R
0.0184430.019449

10,000 iterations each

Dynamic Variables

BenchmarkCodeAHK v1.0.48.05AHK v1.1.08.01
Dynamic variable access
% %Variable%
0.0018300.002741
Dynamic variable assignment
%Variable% = abcdeg
0.0018890.002736

1,000,000 iterations each

System Information

FieldValue
AutoHotkey VersionAutoHotkey v1.0.48.05 ANSI (x86)
OS NameMicrosoft Windows 7 Ultimate
OS Version6.1.7601 Service Pack 1 Build 7601
OS ConfigurationStandalone Workstation
OS Build TypeMultiprocessor Free
System ManufacturerMICRO-STAR INTERNATIONAL CO.,LTD
System ModelMS-7599
System Typex64-based PC
Processor(s)1 Processor(s) Installed.,[01]: AMD64 Family 16 Model 5 Stepping 3 AuthenticAMD ~3300 Mhz
BIOS VersionAmerican Megatrends Inc. V1.15, 04.03.11
Total Physical Memory8,191 MB
Available Physical Memory5,279 MB
Virtual Memory: Max Size9,213 MB
Virtual Memory: Available6,096 MB