#/bm (benchmark)
# alias to evaluate and calculate command speed
# Original author: Tom- (SwiftIRC)
###############################################
alias bm {
var %out $iif($regex($1,/^\-.?m/),say,echo),%bm $iif($left($1,1) == -,$2-,$1-),%c $regex($1,/^\-.?c/)
if (%bm) {
var %x $iif(%c,10000,1),%t $ticks
while (%x) {
scon -r noop $replace(%bm,$chr(124),$chr(124) scon -r noop)
dec %x
}
var %t $bytes($calc($ticks - %t),b)
%out $qt(%bm) $iif(%c,x10000) 7== $eval(%bm,2) $+(14,$chr(40),%t $+ ms,14,$chr(41))
}
}
Comments