Tips for reducing slow execution and lag time?

In KM, a "Switch/Case" should be faster than nested "If"s -- one action vs many and a macro only executes (at most) one action per millisecond.

For me, 1,000 repeats of a 5-Case Switch that always matches the last Case takes ~3 seconds. The equivalent nested If takes ~12s. Matching on the first case/if takes ~2s or ~3s respectively.

So while there is a difference between the two you'll need to be doing a lot of branching for your choice to make much impact. I'd worry more about nested "If"s counting towards the maximum number of concurrently executing macros.

Pre-compiling apparently makes little difference. You still have to instantiate the environment they'll run in, so if there is a difference it'll only become noticeable with the longer scripts.

1 Like