AutoHotkey Benchmarks
Contents
Control Group
Benchmark | Code | AHK Basic (ms) | AHK_L ANSI (ms) | AHK_L Unicode (ms) |
---|
Blank Run | (None) | 0.000445 | 0.000775 | 0.000538 |
1,000,000 iterations each
Assignment
Benchmark | Code | AHK Basic (ms) | AHK_L ANSI (ms) | AHK_L Unicode (ms) |
---|
Classic | Variable = Lorem ipsum dolor sit amet | 0.000627 | 0.001093 | 0.000747 |
Expression | Variable := "Lorem ipsum dolor sit amet" | 0.000742 | 0.001324 | 0.000914 |
1,000,000 iterations each
Comparison
Benchmark | Code | AHK Basic (ms) | AHK_L ANSI (ms) | AHK_L Unicode (ms) |
---|
Classic If statement | If Variable = abcdef
Return | 0.000769 | 0.001558 | 0.000976 |
Expression If statement | If (Variable = "abcdef")
Return | 0.000786 | 0.001711 | 0.001083 |
List comparison | If Variable In abcdef
Return | 0.000927 | 0.001845 | 0.001073 |
Ternary | % (Variable = "abcdef") ? "" : "" | 0.000850 | 0.002052 | 0.001151 |
Classic If between | If Variable Between 123 And 124
Return | 0.000898 | 0.002078 | 0.001095 |
Expression If between | If (Variable >= 123 && Variable <= 124)
Return | 0.001059 | 0.002421 | 0.001314 |
1,000,000 iterations each
String Searching
Benchmark | Code | AHK Basic (ms) | AHK_L ANSI (ms) | AHK_L Unicode (ms) |
---|
String search statement | IfInString, Variable, abcdef
Return | 0.001028 | 0.002496 | 0.001246 |
List search statement | If Variable Contains abcdef
Return | 0.001130 | 0.002711 | 0.001416 |
String get position command | StringGetPos, Temp1, Variable, abcdef | 0.001224 | 0.002925 | 0.001545 |
In string function | InStr(Variable,"abcdef") | 0.001186 | 0.003079 | 0.001631 |
1,000,000 iterations each
Regular Expressions
Benchmark | Code | AHK Basic (ms) | AHK_L ANSI (ms) | AHK_L Unicode (ms) |
---|
Match function | RegExMatch(Variable,"S)abcdef$") | 0.001376 | 0.003559 | 0.002447 |
Replace function | RegExReplace(Variable,"S)c") | 0.002849 | 0.005469 | 0.004191 |
500,000 iterations each
String Manipulation
Benchmark | Code | AHK Basic (ms) | AHK_L ANSI (ms) | AHK_L Unicode (ms) |
---|
Substring function | SubStr(Variable,2,3) | 0.001254 | 0.003610 | 0.001811 |
String middle command | StringMid, Temp1, Variable, 2, 3 | 0.001422 | 0.003968 | 0.002142 |
String trim command | StringTrimLeft, Temp1, Variable, 1 | 0.001342 | 0.003936 | 0.002061 |
String replace command | StringReplace, Temp1, Variable, c, c, All | 0.001984 | 0.004461 | 0.002484 |
1,000,000 iterations each
String Operations
Benchmark | Code | AHK Basic (ms) | AHK_L ANSI (ms) | AHK_L Unicode (ms) |
---|
String length function | StrLen(Variable) | 0.001291 | 0.004052 | 0.001697 |
String length command | StringLen, Temp1, Variable | 0.001389 | 0.004210 | 0.001842 |
String split command | StringSplit, Temp, Variable, c | 0.002034 | 0.005435 | 0.002733 |
Case conversion | StringUpper, Temp1, Variable | 0.001769 | 0.004776 | 0.002171 |
1,000,000 iterations each
Files
Benchmark | Code | AHK Basic (ms) | AHK_L ANSI (ms) | AHK_L Unicode (ms) |
---|
File attributes and exists function | FileExist(A_ScriptFullPath) | 0.021436 | 0.025170 | 0.022534 |
If file exists | IfExist, %A_ScriptFullPath%
Return | 0.019861 | 0.025229 | 0.021602 |
Get size | FileGetSize, Temp1,%A_ScriptFullPath% | 0.062778 | 0.069365 | 0.060764 |
Read file | FileRead, Temp1, *m100 %A_ScriptFullPath% | 0.065955 | 0.072268 | 0.072692 |
Read file line | FileReadLine, Temp1, %A_ScriptFullPath%, 2 | 0.081319 | 0.183643 | 0.182242 |
Append to file | FileAppend, c, %A_Temp%\Temp.txt | 0.496825 | 0.494181 | 0.678479 |
Copy file | FileCopy, %A_Temp%\Temp.txt, %A_Temp%\Temp1.txt, 1 | 1.325577 | 1.010889 | 1.190166 |
Move file | FileMove, %A_Temp%\Temp.txt, %A_Temp%\Temp.txt, 1 | 1.178082 | 1.132570 | 1.072301 |
Filesystem loop | Loop, %A_ScriptFullPath%
Return | 0.060592 | 0.067713 | 0.062967 |
File reading loop | Loop, Read, %A_ScriptFullPath%
Return | 0.078363 | 0.180577 | 0.174835 |
5,000 iterations each
Control Flow
Benchmark | Code | AHK Basic (ms) | AHK_L ANSI (ms) | AHK_L Unicode (ms) |
---|
Normal loop | Loop
Return | 0.001890 | 0.006300 | 0.002559 |
While loop | While, 1
Return | 0.001784 | 0.006340 | 0.002555 |
Parsing loop | Loop, Parse, Variable
Return | 0.002119 | 0.006877 | 0.003634 |
Blank subroutine call | Gosub, BlankLabel | 0.001946 | 0.006723 | 0.002859 |
Blank function call | BlankFunction() | 0.001985 | 0.007031 | 0.002980 |
1,000,000 iterations each
Environment Variables
Benchmark | Code | AHK Basic (ms) | AHK_L ANSI (ms) | AHK_L Unicode (ms) |
---|
Set environment variable | EnvSet, EnvVar, abcdeg | 0.004653 | 0.009730 | 0.005164 |
Get environment variable | EnvGet, Temp1, EnvVar | 0.003194 | 0.008345 | 0.002942 |
500,000 iterations each
Keyboard and mouse
Benchmark | Code | AHK Basic (ms) | AHK_L ANSI (ms) | AHK_L Unicode (ms) |
---|
Get mouse position | MouseGetPos, Temp1, Temp2 | 0.003751 | 0.011294 | 0.006875 |
Move mouse | MouseMove, 0, 0, 0, R | 10.189232 | 10.169775 | 10.161133 |
5,000 iterations each
Field | Value |
---|
AutoHotkey Version | AutoHotkey v1.0.48.05 ANSI (x86) |
OS Name | Microsoft Windows 7 Ultimate |
OS Version | 6.1.7600 Build 7600 |
OS Configuration | Not Available |
OS Build Type | Not Available |
System Manufacturer | Dell Inc. |
System Model | Inspiron 1525 |
System Type | X86-based PC |
Processor(s) | Intel(R) Core(TM)2 Duo CPU T5750 @ 2.00GHz, 2000 Mhz, 2 Core(s), 2 Logical Processor(s) |
BIOS Version | Dell Inc. A17, 10/27/2009 |
Total Physical Memory | 2.99 GB |
Available Physical Memory | 1.72 GB |
Virtual Memory: Max Size | 5.98 GB |
Virtual Memory: Available | 4.34 GB |