Methods for Optimising Macro Execution?

Hi, what are the methods for optimising macro execution? I have many multiple action macros that also trigger other macros when they run, also some of the macros have If statements based upon screen image conditions. Do you have any guidance for optimising macro execution? I find that sometimes by adding the pause action the macros can run slightly faster.

Generally this is only a question you would ask if you have a macro that takes a significant amount of your time, otherwise you should optimise your own time and not worry about how long Keyboard Maestro takes.

  • Minimise the number of action executions. Keyboard Maestro executes 1000 actions per second, so thats the upper limit on the speed if you are executing lots of actions.
  • Minimise the use of slow actions like matching the screen.
  • Minimise the time taken by actions that take time (eg scripts).

It would be very unusual that adding a pause would make it run faster, but here is an example:

  • Do something that will cause the screen to quickly but not instantly change.
  • Pause Until the screen contains the new image.

Now in the case where the “quickly but not instantly” is longer than 0.001 seconds, and shorter than the time it takes Keyboard Maestro to find an image on the screen (which is very dependent on your hardware speed and screen size), then Keyboard Maestro will have to look for the match twice. Adding a small pause would mean Keyboard Maestro would only have to look for the image once.

But this is a very rare instance, there are not likely to be too many of these kinds of cases.

1 Like