AutoHotkey Benchmarks
Contents
Control Group
Benchmark | Code | Average time per run (ms) |
---|
Blank Run | (None) | 0.000986 |
1,000,000 iterations each
Assignment
Benchmark | Code | Average time per run (ms) |
---|
Classic | Variable = Lorem ipsum dolor sit amet | 0.001383 |
Classic with variable | Variable = Lorem ipsum %OtherVariable% dolor sit amet | 0.001674 |
Expression | Variable := "Lorem ipsum dolor sit amet" | 0.001913 |
Expression with variable | Variable := "Lorem ipsum" . OtherVariable . " dolor sit amet" | 0.002392 |
Expression explicit concatenation | Variable := "Lorem ipsum" . " dolor sit amet" | 0.002431 |
Expression implicit concatenation | Variable := "Lorem ipsum" " dolor sit amet" | 0.002641 |
1,000,000 iterations each
Comparison
Benchmark | Code | Average time per run (ms) |
---|
Classic If statement | If Variable = abcdef
Return | 0.002863 |
Expression If statement | If (Variable = "abcdef")
Return | 0.003040 |
List comparison | If Variable In abcdef
Return | 0.003248 |
Ternary | % (Variable = "abcdef") ? "" : "" | 0.003514 |
Classic If between | If Variable Between 123 And 124
Return | 0.003608 |
Expression If between | If (Variable >= 123 && Variable <= 124)
Return | 0.004021 |
1,000,000 iterations each
String Searching
Benchmark | Code | Average time per run (ms) |
---|
String search statement | IfInString, Variable, abcdef
Return | 0.004084 |
List search statement | If Variable Contains abcdef
Return | 0.004312 |
String get position command | StringGetPos, Temp1, Variable, abcdef | 0.004619 |
In string function | InStr(Variable,"abcdef") | 0.004771 |
1,000,000 iterations each
Regular Expressions
Benchmark | Code | Average time per run (ms) |
---|
Match function | RegExMatch(Variable,"S)ab.*?.f$") | 0.005257 |
Replace function | RegExReplace(Variable,"S)ab.*?.f$","$0") | 0.005501 |
Static match | RegExMatch(Variable,"S)abcdef") | 0.005555 |
Static replace | RegExReplace(Variable,"c","c") | 0.006701 |
500,000 iterations each
String Manipulation
Benchmark | Code | Average time per run (ms) |
---|
Substring function | SubStr(Variable,2,3) | 0.005713 |
String middle command | StringMid, Temp1, Variable, 2, 3 | 0.006276 |
String trim command | StringTrimLeft, Temp1, Variable, 1 | 0.006263 |
String replace command | StringReplace, Temp1, Variable, c, c, All | 0.007259 |
1,000,000 iterations each
String Operations
Benchmark | Code | Average time per run (ms) |
---|
String length function | StrLen(Variable) | 0.006521 |
String length command | StringLen, Temp1, Variable | 0.006726 |
String split command | StringSplit, Temp, Variable, c | 0.008232 |
Case conversion | StringUpper, Temp1, Variable | 0.007364 |
1,000,000 iterations each
Files
Benchmark | Code | Average time per run (ms) |
---|
File attributes and exists function | FileExist(A_ScriptFullPath) | 0.147666 |
If file exists | IfExist, %A_ScriptFullPath%
Return | 0.146605 |
Get size | FileGetSize, Temp1,%A_ScriptFullPath% | 0.148101 |
Read file | FileRead, Temp1, *m100 %A_ScriptFullPath% | 0.161226 |
Read file line | FileReadLine, Temp1, %A_ScriptFullPath%, 2 | 0.138596 |
Append to file | FileAppend, c, %A_Temp%\Temp.txt | 1.254668 |
Copy file | FileCopy, %A_Temp%\Temp.txt, %A_Temp%\Temp1.txt, 1 | 2.917299 |
Move file | FileMove, %A_Temp%\Temp.txt, %A_Temp%\Temp.txt, 1 | 2.687115 |
Filesystem loop | Loop, %A_ScriptFullPath%
Return | 0.151094 |
File reading loop | Loop, Read, %A_ScriptFullPath%
Return | 0.141932 |
5,000 iterations each
Control Flow
Benchmark | Code | Average time per run (ms) |
---|
Normal loop | Loop, 1
{
} | 0.009330 |
While loop | While, (A_Index = 1)
{
} | 0.009746 |
Parsing loop | Loop, Parse, Variable, ,
{
} | 0.010332 |
Blank subroutine call | Gosub, BlankLabel | 0.009894 |
Blank function call | BlankFunction() | 0.010237 |
1,000,000 iterations each
Environment Variables
Benchmark | Code | Average time per run (ms) |
---|
Set environment variable | EnvSet, EnvVar, abcdeg | 0.013735 |
Get environment variable | EnvGet, Temp1, EnvVar | 0.011824 |
500,000 iterations each
Keyboard and mouse
Benchmark | Code | Average time per run (ms) |
---|
Get mouse position | MouseGetPos, Temp1, Temp2 | 0.014500 |
Move mouse | MouseMove, 0, 0, 0, R | 0.067884 |
10,000 iterations each
Dynamic Variables
Benchmark | Code | Average time per run (ms) |
---|
Dynamic variable access | % %Variable% | 0.011777 |
Dynamic variable assignment | %Variable% = abcdeg | 0.011863 |
1,000,000 iterations each
Field | Value |
---|
AutoHotkey Version | AutoHotkey v1.1.04.01 ANSI (x86) |
OS Name | Microsoft Windows 7 Enterprise |
OS Version | 6.1.7601 Service Pack 1 Build 7601 |
OS Configuration | Standalone Workstation |
OS Build Type | Multiprocessor Free |
System Manufacturer | Dell Inc. |
System Model | Latitude D620 |
System Type | X86-based PC |
Processor(s) | 1 Processor(s) Installed.,[01]: x86 Family 6 Model 14 Stepping 8 GenuineIntel ~1833 Mhz |
BIOS Version | Dell Inc. A04, 8/28/2006 |
Total Physical Memory | 3,062 MB |
Available Physical Memory | 1,103 MB |
Virtual Memory: Max Size | 6,123 MB |
Virtual Memory: Available | 3,529 MB |