AutoHotkey Benchmarks
Contents
Control Group
Benchmark | Code | AHK v1.0.48.05 | AHK v1.1.08.01 |
---|
Blank Run | (None) | 0.000340 | 0.000360 |
1,000,000 iterations each
Assignment
Benchmark | Code | AHK v1.0.48.05 | AHK v1.1.08.01 |
---|
Classic | Variable = Lorem ipsum dolor sit amet | 0.000473 | 0.000472 |
Classic with variable | Variable = Lorem ipsum %OtherVariable% dolor sit amet | 0.000505 | 0.000558 |
Expression | Variable := "Lorem ipsum dolor sit amet" | 0.000562 | 0.000603 |
Expression with variable | Variable := "Lorem ipsum" . OtherVariable . " dolor sit amet" | 0.000675 | 0.000764 |
Expression explicit concatenation | Variable := "Lorem ipsum" . " dolor sit amet" | 0.000644 | 0.000739 |
Expression implicit concatenation | Variable := "Lorem ipsum" " dolor sit amet" | 0.000666 | 0.000795 |
1,000,000 iterations each
Comparison
Benchmark | Code | AHK v1.0.48.05 | AHK v1.1.08.01 |
---|
Classic If statement | If Variable = abcdef
Return | 0.000662 | 0.000815 |
Expression If statement | If (Variable = "abcdef")
Return | 0.000654 | 0.000839 |
List comparison | If Variable In abcdef
Return | 0.000726 | 0.000915 |
Ternary | % (Variable = "abcdef") ? "" : "" | 0.000773 | 0.000983 |
Classic If between | If Variable Between 123 And 124
Return | 0.000771 | 0.001020 |
Expression If between | If (Variable >= 123 && Variable <= 124)
Return | 0.000902 | 0.001119 |
1,000,000 iterations each
String Searching
Benchmark | Code | AHK v1.0.48.05 | AHK v1.1.08.01 |
---|
String search statement | IfInString, Variable, abcdef
Return | 0.000876 | 0.001154 |
List search statement | If Variable Contains abcdef
Return | 0.000922 | 0.001196 |
String get position command | StringGetPos, Temp1, Variable, abcdef | 0.000964 | 0.001258 |
In string function | InStr(Variable,"abcdef") | 0.000946 | 0.001277 |
1,000,000 iterations each
Regular Expressions
Benchmark | Code | AHK v1.0.48.05 | AHK v1.1.08.01 |
---|
Match function | RegExMatch(Variable,"S)ab.*?.f$") | 0.001083 | 0.001442 |
Replace function | RegExReplace(Variable,"S)ab.*?.f$","$0") | 0.001126 | 0.001580 |
Static match | RegExMatch(Variable,"S)abcdef") | 0.001124 | 0.001488 |
Static replace | RegExReplace(Variable,"c","c") | 0.001710 | 0.001763 |
500,000 iterations each
String Manipulation
Benchmark | Code | AHK v1.0.48.05 | AHK v1.1.08.01 |
---|
Substring function | SubStr(Variable,2,3) | 0.001038 | 0.001436 |
String middle command | StringMid, Temp1, Variable, 2, 3 | 0.001184 | 0.001643 |
String trim command | StringTrimLeft, Temp1, Variable, 1 | 0.001113 | 0.001583 |
String replace command | StringReplace, Temp1, Variable, c, c, All | 0.001505 | 0.001846 |
1,000,000 iterations each
String Operations
Benchmark | Code | AHK v1.0.48.05 | AHK v1.1.08.01 |
---|
String length function | StrLen(Variable) | 0.001088 | 0.001596 |
String length command | StringLen, Temp1, Variable | 0.001183 | 0.001672 |
String split command | StringSplit, Temp, Variable, c | 0.001596 | 0.002130 |
Case conversion | StringUpper, Temp1, Variable | 0.001420 | 0.001915 |
1,000,000 iterations each
Files
Benchmark | Code | AHK v1.0.48.05 | AHK v1.1.08.01 |
---|
File attributes and exists function | FileExist(A_ScriptFullPath) | 0.013291 | 0.007830 |
If file exists | IfExist, %A_ScriptFullPath%
Return | 0.014343 | 0.006953 |
Get size | FileGetSize, Temp1,%A_ScriptFullPath% | 0.030777 | 0.029339 |
Read file | FileRead, Temp1, *m100 %A_ScriptFullPath% | 0.037404 | 0.035044 |
Read file line | FileReadLine, Temp1, %A_ScriptFullPath%, 2 | 0.053370 | 0.038042 |
Append to file | FileAppend, c, %A_Temp%\Temp.txt | 1.170471 | 1.436660 |
Copy file | FileCopy, %A_Temp%\Temp.txt, %A_Temp%\Temp1.txt, 1 | 1.000203 | 0.941176 |
Move file | FileMove, %A_Temp%\Temp.txt, %A_Temp%\Temp.txt, 1 | 0.755071 | 0.728750 |
Filesystem loop | Loop, %A_ScriptFullPath%
Return | 0.025272 | 0.022870 |
File reading loop | Loop, Read, %A_ScriptFullPath%
Return | 0.046510 | 0.037617 |
5,000 iterations each
Control Flow
Benchmark | Code | AHK v1.0.48.05 | AHK v1.1.08.01 |
---|
Normal loop | Loop, 1
{
} | 0.001538 | 0.002280 |
While loop | While, (A_Index = 1)
{
} | 0.001678 | 0.002401 |
Parsing loop | Loop, Parse, Variable, ,
{
} | 0.001909 | 0.002582 |
Blank subroutine call | Gosub, BlankLabel | 0.001603 | 0.002317 |
Blank function call | BlankFunction() | 0.001649 | 0.002430 |
1,000,000 iterations each
Environment Variables
Benchmark | Code | AHK v1.0.48.05 | AHK v1.1.08.01 |
---|
Set environment variable | EnvSet, EnvVar, abcdeg | 0.003824 | 0.004967 |
Get environment variable | EnvGet, Temp1, EnvVar | 0.002340 | 0.002613 |
500,000 iterations each
Keyboard and mouse
Benchmark | Code | AHK v1.0.48.05 | AHK v1.1.08.01 |
---|
Get mouse position | MouseGetPos, Temp1, Temp2 | 0.005014 | 0.005788 |
Move mouse | MouseMove, 0, 0, 0, R | 0.018443 | 0.019449 |
10,000 iterations each
Dynamic Variables
Benchmark | Code | AHK v1.0.48.05 | AHK v1.1.08.01 |
---|
Dynamic variable access | % %Variable% | 0.001830 | 0.002741 |
Dynamic variable assignment | %Variable% = abcdeg | 0.001889 | 0.002736 |
1,000,000 iterations each
Field | Value |
---|
AutoHotkey Version | AutoHotkey v1.0.48.05 ANSI (x86) |
OS Name | Microsoft Windows 7 Ultimate |
OS Version | 6.1.7601 Service Pack 1 Build 7601 |
OS Configuration | Standalone Workstation |
OS Build Type | Multiprocessor Free |
System Manufacturer | MICRO-STAR INTERNATIONAL CO.,LTD |
System Model | MS-7599 |
System Type | x64-based PC |
Processor(s) | 1 Processor(s) Installed.,[01]: AMD64 Family 16 Model 5 Stepping 3 AuthenticAMD ~3300 Mhz |
BIOS Version | American Megatrends Inc. V1.15, 04.03.11 |
Total Physical Memory | 8,191 MB |
Available Physical Memory | 5,279 MB |
Virtual Memory: Max Size | 9,213 MB |
Virtual Memory: Available | 6,096 MB |