oof, that's more than i originally thought
![crazy crazy](/images/graemlins/mirc/crazy.gif)
first off, if you were using my snippet to perform the benchmark on those aliases, did you include the -c switch to have the code interpreted as a command? if not, it will have performed
/noop test1 rather than
/test1 100,000 times.
now, the problem with those tests is that there is a lot more happening in both cases than what we are examining.
first of all, /test1 is called by the benchmark snippet requiring mIRC to browse through your loaded aliases until it finds 'test1'. the two /var commands are translated to /set -l and mIRC is twice asked to browse through loaded aliases again (this time looking for a custom 'set' alias). then there's the creation and assigning of two local variables.
to give you some idea of how much extra work is being performed: 100,000 iterations of /test1 take my machine 5 seconds whereas 100,000 evaluations of '%v [ $+ [ $me ] ]' takes it 900ms. it's this unnecessary 4.1 seconds that you should aim to minimize, and you can do that quite effectively with the following tests:
/benchmark -s100 100000 %v [ $+ [ $me ] ]
/benchmark -s100 100000 $($+(%,v,$me),2)
why? because rather than this:
var %m = 100000 | while (%m) { test1 | dec %m }
the alias creates and executes code such as this:
var %m = 1000 | while (%m) { noop %v [ $+ [ $me ] ] %v [ $+ [ $me ] ] %v [ $+ [ $me ] ] ... 100 times total ... %v [ $+ [ $me ] ] | dec %m }
%v [ $+ [ $me ] ] is still being evaluated 100,000 times, but in a much more direct and simplistic manner.