I tried posting this suggestion a couple weeks ago, then my computer crashed and I forgot all about it.
It would be nice if mIRC had a command for speed testing code using a high definition (multimedia) timer.
/bench [N] <code|alias|identifier>
The /bench command would evaluate the code, alias, or identifier N times (1 by default), and output the time it took (in milliseconds) to process the specified code. The $bench identifier would work the same, but return the results.
Output of the code tested would be suppressed, including display output and commands sent to the server. Ideally, only simple routines would be tested, but to prevent display/server floods, all output would be suppressed. Perhaps some flags could be added to bypass this default in some extreme case where display output lag is a desired variable.
/bench 10000 var %s = (abc) (def) (hij) | $regex(%s,/(\(.*?\))/g) | echo -a $regml(3)
/bench 10000 var %s = (abc) (def) (hij) | $regex(%s,/\(.*?\) \(.*?\) (\(.*?\))/) | echo -a $regml(1)
/bench 10000 var %s = (abc) (def) (hij) | $regsub(%s,/\(.*?\) \(.*?\) (\(.*?\))/,\1,%s) | echo -a %s
In each example, a regular expression and method is processed 10,000 times. The /echo -a display is surpressed, but included because the user wants to take the evaluation of $regml verse %s into consideration aswell. The output of /bench may look something like:
* Bench Results: 10000 iterations in 1931 ms
I know many people do this with var %ticks = $ticks and $calc($ticks - %ticks), I do too. But you usually end up writing a new speed testing routine for each circumstance, and worry about overhead from your WHILE loop and /inc. This overhead could be reduced significantly with internal looping. $ticks is also a fairly inaccurate timer, while a high resolution multimedia timer could be used internally.
Thanks for reading. Constructive criticism welcomed.
At least I won lunch.
Good philosophy, see good in bad, I like!