AutoHotkey Benchmarks

Contents

Control Group

BenchmarkCodeAHK Basic (ms)AHK_L ANSI (ms)AHK_L Unicode (ms)
Blank Run
(None)
0.0004450.0007750.000538

1,000,000 iterations each

Assignment

BenchmarkCodeAHK Basic (ms)AHK_L ANSI (ms)AHK_L Unicode (ms)
Classic
Variable = Lorem ipsum dolor sit amet
0.0006270.0010930.000747
Expression
Variable := "Lorem ipsum dolor sit amet"
0.0007420.0013240.000914

1,000,000 iterations each

Comparison

BenchmarkCodeAHK Basic (ms)AHK_L ANSI (ms)AHK_L Unicode (ms)
Classic If statement
If Variable = abcdef
 Return
0.0007690.0015580.000976
Expression If statement
If (Variable = "abcdef")
 Return
0.0007860.0017110.001083
List comparison
If Variable In abcdef
 Return
0.0009270.0018450.001073
Ternary
% (Variable = "abcdef") ? "" : ""
0.0008500.0020520.001151
Classic If between
If Variable Between 123 And 124
 Return
0.0008980.0020780.001095
Expression If between
If (Variable >= 123 && Variable <= 124)
 Return
0.0010590.0024210.001314

1,000,000 iterations each

String Searching

BenchmarkCodeAHK Basic (ms)AHK_L ANSI (ms)AHK_L Unicode (ms)
String search statement
IfInString, Variable, abcdef
 Return
0.0010280.0024960.001246
List search statement
If Variable Contains abcdef
 Return
0.0011300.0027110.001416
String get position command
StringGetPos, Temp1, Variable, abcdef
0.0012240.0029250.001545
In string function
InStr(Variable,"abcdef")
0.0011860.0030790.001631

1,000,000 iterations each

Regular Expressions

BenchmarkCodeAHK Basic (ms)AHK_L ANSI (ms)AHK_L Unicode (ms)
Match function
RegExMatch(Variable,"S)abcdef$")
0.0013760.0035590.002447
Replace function
RegExReplace(Variable,"S)c")
0.0028490.0054690.004191

500,000 iterations each

String Manipulation

BenchmarkCodeAHK Basic (ms)AHK_L ANSI (ms)AHK_L Unicode (ms)
Substring function
SubStr(Variable,2,3)
0.0012540.0036100.001811
String middle command
StringMid, Temp1, Variable, 2, 3
0.0014220.0039680.002142
String trim command
StringTrimLeft, Temp1, Variable, 1
0.0013420.0039360.002061
String replace command
StringReplace, Temp1, Variable, c, c, All
0.0019840.0044610.002484

1,000,000 iterations each

String Operations

BenchmarkCodeAHK Basic (ms)AHK_L ANSI (ms)AHK_L Unicode (ms)
String length function
StrLen(Variable)
0.0012910.0040520.001697
String length command
StringLen, Temp1, Variable
0.0013890.0042100.001842
String split command
StringSplit, Temp, Variable, c
0.0020340.0054350.002733
Case conversion
StringUpper, Temp1, Variable
0.0017690.0047760.002171

1,000,000 iterations each

Files

BenchmarkCodeAHK Basic (ms)AHK_L ANSI (ms)AHK_L Unicode (ms)
File attributes and exists function
FileExist(A_ScriptFullPath)
0.0214360.0251700.022534
If file exists
IfExist, %A_ScriptFullPath%
 Return
0.0198610.0252290.021602
Get size
FileGetSize, Temp1,%A_ScriptFullPath%
0.0627780.0693650.060764
Read file
FileRead, Temp1, *m100 %A_ScriptFullPath%
0.0659550.0722680.072692
Read file line
FileReadLine, Temp1, %A_ScriptFullPath%, 2
0.0813190.1836430.182242
Append to file
FileAppend, c, %A_Temp%\Temp.txt
0.4968250.4941810.678479
Copy file
FileCopy, %A_Temp%\Temp.txt, %A_Temp%\Temp1.txt, 1
1.3255771.0108891.190166
Move file
FileMove, %A_Temp%\Temp.txt, %A_Temp%\Temp.txt, 1
1.1780821.1325701.072301
Filesystem loop
Loop, %A_ScriptFullPath%
 Return
0.0605920.0677130.062967
File reading loop
Loop, Read, %A_ScriptFullPath%
 Return
0.0783630.1805770.174835

5,000 iterations each

Control Flow

BenchmarkCodeAHK Basic (ms)AHK_L ANSI (ms)AHK_L Unicode (ms)
Normal loop
Loop
 Return
0.0018900.0063000.002559
While loop
While, 1
 Return
0.0017840.0063400.002555
Parsing loop
Loop, Parse, Variable
 Return
0.0021190.0068770.003634
Blank subroutine call
Gosub, BlankLabel
0.0019460.0067230.002859
Blank function call
BlankFunction()
0.0019850.0070310.002980

1,000,000 iterations each

Environment Variables

BenchmarkCodeAHK Basic (ms)AHK_L ANSI (ms)AHK_L Unicode (ms)
Set environment variable
EnvSet, EnvVar, abcdeg
0.0046530.0097300.005164
Get environment variable
EnvGet, Temp1, EnvVar
0.0031940.0083450.002942

500,000 iterations each

Keyboard and mouse

BenchmarkCodeAHK Basic (ms)AHK_L ANSI (ms)AHK_L Unicode (ms)
Get mouse position
MouseGetPos, Temp1, Temp2
0.0037510.0112940.006875
Move mouse
MouseMove, 0, 0, 0, R
10.18923210.16977510.161133

5,000 iterations each

System Information

FieldValue
AutoHotkey VersionAutoHotkey v1.0.48.05 ANSI (x86)
OS NameMicrosoft Windows 7 Ultimate
OS Version6.1.7600 Build 7600
OS ConfigurationNot Available
OS Build TypeNot Available
System ManufacturerDell Inc.
System ModelInspiron 1525
System TypeX86-based PC
Processor(s)Intel(R) Core(TM)2 Duo CPU T5750 @ 2.00GHz, 2000 Mhz, 2 Core(s), 2 Logical Processor(s)
BIOS VersionDell Inc. A17, 10/27/2009
Total Physical Memory2.99 GB
Available Physical Memory1.72 GB
Virtual Memory: Max Size5.98 GB
Virtual Memory: Available4.34 GB