The following commands may affect performance depending on the nature of the script: SendMode, SetKeyDelay, SetMouseDelay, SetWinDelay, SetControlDelay, and SetDefaultMouseSpeed.
Built-in Performance Features
Each script is semi-compiled while it is being loaded and syntax-checked. In addition to reducing the memory consumed by the script, this also greatly improves runtime performance.
Here are the technical details of the optimization process (semi-compiling):
- Input and output variables (when their names don't contain references to other variables) and group names are resolved to memory addresses.
- Loops, blocks, IFs, and ELSEs are given the memory addresses of their related jump-points in the script.
- The destination of each Hotkey, Gosub, and Goto is resolved to a memory address unless it is a variable.
- Each command name is replaced by an address in a jump table.
- Each line is pre-parsed into a list of parameters, and each parameter is pre-parsed into a list of variables (if any).
- Each expression is tokenized and converted from infix to postfix.
- Each reference to a variable or function is resolved to a memory address.
- Literal integers in expressions are replaced with binary integers.
In addition, during script execution, binary numbers are cached in variables to avoid conversions to/from strings.