AutoHotkey Benchmarks
Contents
Control Group
Benchmark | Code | Average time per run (ms) |
---|
Blank Run | (None) | 0.000976 |
1,000,000 iterations each
Assignment
Benchmark | Code | Average time per run (ms) |
---|
Classic | Variable = Lorem ipsum dolor sit amet | 0.001471 |
Classic with variable | Variable = Lorem ipsum %OtherVariable% dolor sit amet | 0.001731 |
Expression | Variable := "Lorem ipsum dolor sit amet" | 0.001771 |
Expression with variable | Variable := "Lorem ipsum" . OtherVariable . " dolor sit amet" | 0.002398 |
Expression explicit concatenation | Variable := "Lorem ipsum" . " dolor sit amet" | 0.002299 |
Expression implicit concatenation | Variable := "Lorem ipsum" " dolor sit amet" | 0.002391 |
1,000,000 iterations each
Comparison
Benchmark | Code | Average time per run (ms) |
---|
Classic If statement | If Variable = abcdef
Return | 0.001961 |
Expression If statement | If (Variable = "abcdef")
Return | 0.002288 |
List comparison | If Variable In abcdef
Return | 0.002275 |
Ternary | % (Variable = "abcdef") ? "" : "" | 0.002519 |
Classic If between | If Variable Between 123 And 124
Return | 0.002510 |
Expression If between | If (Variable >= 123 && Variable <= 124)
Return | 0.002942 |
1,000,000 iterations each
String Searching
Benchmark | Code | Average time per run (ms) |
---|
String search statement | IfInString, Variable, abcdef
Return | 0.002657 |
List search statement | If Variable Contains abcdef
Return | 0.002827 |
String get position command | StringGetPos, Temp1, Variable, abcdef | 0.003139 |
In string function | InStr(Variable,"abcdef") | 0.003333 |
1,000,000 iterations each
Regular Expressions
Benchmark | Code | Average time per run (ms) |
---|
Match function | RegExMatch(Variable,"S)ab.*?.f$") | 0.003914 |
Replace function | RegExReplace(Variable,"S)ab.*?.f$","$0") | 0.004511 |
Static match | RegExMatch(Variable,"S)abcdef") | 0.003945 |
Static replace | RegExReplace(Variable,"c","c") | 0.007011 |
500,000 iterations each
String Manipulation
Benchmark | Code | Average time per run (ms) |
---|
Substring function | SubStr(Variable,2,3) | 0.003613 |
String middle command | StringMid, Temp1, Variable, 2, 3 | 0.004185 |
String trim command | StringTrimLeft, Temp1, Variable, 1 | 0.004054 |
String replace command | StringReplace, Temp1, Variable, c, c, All | 0.005122 |
1,000,000 iterations each
String Operations
Benchmark | Code | Average time per run (ms) |
---|
String length function | StrLen(Variable) | 0.003798 |
String length command | StringLen, Temp1, Variable | 0.003835 |
String split command | StringSplit, Temp, Variable, c | 0.005349 |
Case conversion | StringUpper, Temp1, Variable | 0.004441 |
1,000,000 iterations each
Files
Benchmark | Code | Average time per run (ms) |
---|
File attributes and exists function | FileExist(A_ScriptFullPath) | 0.065863 |
If file exists | IfExist, %A_ScriptFullPath%
Return | 0.064546 |
Get size | FileGetSize, Temp1,%A_ScriptFullPath% | 0.079471 |
Read file | FileRead, Temp1, *m100 %A_ScriptFullPath% | 0.114081 |
Read file line | FileReadLine, Temp1, %A_ScriptFullPath%, 2 | 0.114186 |
Append to file | FileAppend, c, %A_Temp%\Temp.txt | 2.736468 |
Copy file | FileCopy, %A_Temp%\Temp.txt, %A_Temp%\Temp1.txt, 1 | 2.088653 |
Move file | FileMove, %A_Temp%\Temp.txt, %A_Temp%\Temp.txt, 1 | 1.853296 |
Filesystem loop | Loop, %A_ScriptFullPath%
Return | 0.082938 |
File reading loop | Loop, Read, %A_ScriptFullPath%
Return | 0.118729 |
5,000 iterations each
Control Flow
Benchmark | Code | Average time per run (ms) |
---|
Normal loop | Loop, 1
{
} | 0.005190 |
While loop | While, (A_Index = 1)
{
} | 0.005820 |
Parsing loop | Loop, Parse, Variable, ,
{
} | 0.006124 |
Blank subroutine call | Gosub, BlankLabel | 0.005250 |
Blank function call | BlankFunction() | 0.005742 |
1,000,000 iterations each
Environment Variables
Benchmark | Code | Average time per run (ms) |
---|
Set environment variable | EnvSet, EnvVar, abcdeg | 0.011602 |
Get environment variable | EnvGet, Temp1, EnvVar | 0.006196 |
500,000 iterations each
Keyboard and mouse
Benchmark | Code | Average time per run (ms) |
---|
Get mouse position | MouseGetPos, Temp1, Temp2 | 0.008809 |
Move mouse | MouseMove, 0, 0, 0, R | 0.199727 |
10,000 iterations each
Dynamic Variables
Benchmark | Code | Average time per run (ms) |
---|
Dynamic variable access | % %Variable% | 0.006263 |
Dynamic variable assignment | %Variable% = abcdeg | 0.006228 |
1,000,000 iterations each
Field | Value |
---|
AutoHotkey Version | AutoHotkey v1.1.05.06 Unicode (x64) |
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 | TOSHIBA |
System Model | Satellite C655D |
System Type | x64-based PC |
Processor(s) | 1 Processor(s) Installed.,[01]: AMD64 Family 20 Model 1 Stepping 0 AuthenticAMD ~1600 Mhz |
BIOS Version | Insyde Corp. 1.60, 6/23/2011 |
Total Physical Memory | 2,663 MB |
Available Physical Memory | 993 MB |
Virtual Memory: Max Size | 5,324 MB |
Virtual Memory: Available | 2,770 MB |