Probably not a lot of people will run into this - possibly only me, but I thought I’d post it anyway.
Many of us like to “clean up” variables at the end of our macros, by setting all the variables used in the macro to %Delete%.
Good idea. Highly recommend.
However, setting variables to %Delete% is not free, time-wise. In fact, you might be surprised to know it can be slower than you might think.
However, most if not all of the time, you’ll never notice. Especially if you do the cleanup at the end of a macro, after the macro’s done it’s work. You’d never notice, because you’re not waiting on anything.
But I’m working on an extremely complex set of macros, with multiple sub-macros, some of which get called multiple times, and some of which have a lot of variables. Since the cleanup for the sub-macros occurs before the main macro has finished its work, the time starts to become noticeable.
I’m still only talking tenths of a second. But believe it or not, if you get enough of that going on, under the right circumstances, it becomes noticeable.
So I took all the sub-macros’ cleanup code and put it in another sub-macro, which the main macro calls when it’s done. It cut a couple of tenths of seconds off the macro’s launch time, and when I combined that with some other optimization, it made a big difference (to me).
As I said at the start, this is unlikely to impact most people. In fact, it may only ever impact me, because I have to over-engineer everything. But on the off chance this info might someday help someone else, I decided to post it.