AutoHotkey Benchmarks
Contents
Control Group
Benchmark | Code | Average time per run (ms) |
---|
Blank Run | (None) | 0.000558 |
1,000,000 iterations each
Assignment
Benchmark | Code | Average time per run (ms) |
---|
Classic | Variable = Lorem ipsum dolor sit amet | 0.000790 |
Classic with variable | Variable = Lorem ipsum %OtherVariable% dolor sit amet | 0.000887 |
Expression | Variable := "Lorem ipsum dolor sit amet" | 0.000947 |
Expression with variable | Variable := "Lorem ipsum" . OtherVariable . " dolor sit amet" | 0.001283 |
Expression explicit concatenation | Variable := "Lorem ipsum" . " dolor sit amet" | 0.001121 |
Expression implicit concatenation | Variable := "Lorem ipsum" " dolor sit amet" | 0.001251 |
1,000,000 iterations each
Comparison
Benchmark | Code | Average time per run (ms) |
---|
Classic If statement | If Variable = abcdef
Return | 0.001137 |
Expression If statement | If (Variable = "abcdef")
Return | 0.001162 |
List comparison | If Variable In abcdef
Return | 0.001317 |
Ternary | % (Variable = "abcdef") ? "" : "" | 0.001266 |
Classic If between | If Variable Between 123 And 124
Return | 0.001312 |
Expression If between | If (Variable >= 123 && Variable <= 124)
Return | 0.001523 |
1,000,000 iterations each
String Searching
Benchmark | Code | Average time per run (ms) |
---|
String search statement | IfInString, Variable, abcdef
Return | 0.001476 |
List search statement | If Variable Contains abcdef
Return | 0.001816 |
String get position command | StringGetPos, Temp1, Variable, abcdef | 0.001674 |
In string function | InStr(Variable,"abcdef") | 0.001637 |
1,000,000 iterations each
Regular Expressions
Benchmark | Code | Average time per run (ms) |
---|
Match function | RegExMatch(Variable,"S)ab.*?.f$") | 0.001839 |
Replace function | RegExReplace(Variable,"S)ab.*?.f$","$0") | 0.001960 |
Static match | RegExMatch(Variable,"S)abcdef") | 0.001910 |
Static replace | RegExReplace(Variable,"c","c") | 0.002762 |
500,000 iterations each
String Manipulation
Benchmark | Code | Average time per run (ms) |
---|
Substring function | SubStr(Variable,2,3) | 0.001793 |
String middle command | StringMid, Temp1, Variable, 2, 3 | 0.002034 |
String trim command | StringTrimLeft, Temp1, Variable, 1 | 0.001887 |
String replace command | StringReplace, Temp1, Variable, c, c, All | 0.002943 |
1,000,000 iterations each
String Operations
Benchmark | Code | Average time per run (ms) |
---|
String length function | StrLen(Variable) | 0.001875 |
String length command | StringLen, Temp1, Variable | 0.002073 |
String split command | StringSplit, Temp, Variable, c | 0.002824 |
Case conversion | StringUpper, Temp1, Variable | 0.002372 |
1,000,000 iterations each
Files
Benchmark | Code | Average time per run (ms) |
---|
File attributes and exists function | FileExist(A_ScriptFullPath) | 0.049375 |
If file exists | IfExist, %A_ScriptFullPath%
Return | 0.047152 |
Get size | FileGetSize, Temp1,%A_ScriptFullPath% | 0.091125 |
Read file | FileRead, Temp1, *m100 %A_ScriptFullPath% | 0.085088 |
Read file line | FileReadLine, Temp1, %A_ScriptFullPath%, 2 | 0.103662 |
Append to file | FileAppend, c, %A_Temp%\Temp.txt | 1.505286 |
Copy file | FileCopy, %A_Temp%\Temp.txt, %A_Temp%\Temp1.txt, 1 | 0.864027 |
Move file | FileMove, %A_Temp%\Temp.txt, %A_Temp%\Temp.txt, 1 | 1.007200 |
Filesystem loop | Loop, %A_ScriptFullPath%
Return | 0.099749 |
File reading loop | Loop, Read, %A_ScriptFullPath%
Return | 0.110070 |
5,000 iterations each
Control Flow
Benchmark | Code | Average time per run (ms) |
---|
Normal loop | Loop, 1
{
} | 0.002584 |
While loop | While, (A_Index = 1)
{
} | 0.002816 |
Parsing loop | Loop, Parse, Variable, ,
{
} | 0.003068 |
Blank subroutine call | Gosub, BlankLabel | 0.002626 |
Blank function call | BlankFunction() | 0.002724 |
1,000,000 iterations each
Environment Variables
Benchmark | Code | Average time per run (ms) |
---|
Set environment variable | EnvSet, EnvVar, abcdeg | 0.007395 |
Get environment variable | EnvGet, Temp1, EnvVar | 0.004123 |
500,000 iterations each
Keyboard and mouse
Benchmark | Code | Average time per run (ms) |
---|
Get mouse position | MouseGetPos, Temp1, Temp2 | 0.004172 |
Move mouse | MouseMove, 0, 0, 0, R | 0.024242 |
10,000 iterations each
Dynamic Variables
Benchmark | Code | Average time per run (ms) |
---|
Dynamic variable access | % %Variable% | 0.003248 |
Dynamic variable assignment | %Variable% = abcdeg | 0.003366 |
1,000,000 iterations each
Field | Value |
---|
AutoHotkey Version | AutoHotkey v1.0.48.05 ANSI (x86) |
OS Name | Microsoft Windows 7 Home Premium |
OS Version | 6.1.7601 Service Pack 1 Build 7601 |
OS Configuration | Standalone Workstation |
OS Build Type | Multiprocessor Free |
System Manufacturer | ASUSTeK Computer INC. |
System Model | G72GX |
System Type | x64-based PC |
Processor(s) | 1 Processor(s) Installed.,[01]: Intel64 Family 6 Model 23 Stepping 10 GenuineIntel ~1595 Mhz |
BIOS Version | American Megatrends Inc. 0302 , 9/2/2009 |
Total Physical Memory | 6,143 MB |
Available Physical Memory | 3,959 MB |
Virtual Memory: Max Size | 12,284 MB |
Virtual Memory: Available | 10,076 MB |