general reply:

i had an idea a while ago about an improvement that could be made on existing benchmark scripts. it does not result in benchmarking perfection (that's rather unrealistic), but it's a step towards it i hope :P

the idea involves a certain bold assumption, which is obviously not valid in general, but it's a small modification that we can make to try and compare scripts in a standard way. in particular, it assumes that if you run 2 pieces of code on 2 different machines, the ratio between the execution times on each machine will be the same. this approach is naive and greatly underestimates the true nature of processing code! however, it can be quite accurate and is probably worth considering, so i've modified the code and added some comments:

Code:
; /benchmark <N> [-icm] <text>
;
; Switches: i = identifiers, c = basic commands, m = multiple commands
;
; With no switches it defaults to evaluating <text> as a command unless
; it contains what appears to be identifiers or variables.
;
; You can suppress the first more technical echo with /.benchmark
;
; Identifiers are tested using /!noop <text>
; Commands are tested using /<text>
; Multiple commands are tested using /!scid $cid <text>
;
; If you wish to benchmark structures such as if statements, while 
; loops or /var, you need to use the 'm' switch.
;
; The 'speed factor' is an attempt to standardize the results of these
; benchmarks across a variety of machines by calculating (before and
; after the main benchmark) the time it takes for your PC to perform a
; simple while loop which it then uses in the overall calculation.
; If done correctly, a 'speed factor' should be a property of <text>
; and should be independent of the number of iterations and, more
; importantly, the PC the benchmark is performed on.
;
;
; Basic operations such as the evaluation of $null seem to have
; a speed factor of around 1 or less.
;
; Examples:
;
; /benchmark 20000 -i $crc(text, 0)
; /benchmark 20000 -i $hash(text, 32)
;
; /.benchmark 10000 -m if (8 & 1) noop
; /.benchmark 10000 -m if (2 \\ 8) noop
;
; /benchmark 200 -c /myalias

alias benchmark {

  var %i = 50000 | ; number of iterations to use to determine the 'speed factor'

  if ($1 !isnum) {
    echo -egac info * /benchmark <N> [-icm] <text>
    return
  }
  var %before = %i, %after = %i, %main = $1, %cid = $cid, %identifier, %command, %multi, %out
  if ($2 == -c) {
    %out = / $+ $3-
    %command = $3-
  }
  elseif ($2 == -i) {
    %out = /!noop $3-
    %identifier = $3-
  }
  elseif ($2 == -m) {
    %out = /!scid % $+ cid $3-
    %multi = $3-
  }
  elseif ($wildtok($2-, $!*, 1, 32)) || ($wildtok($2-, % $+ *, 1, 32)) {
    %out = /!noop $2-
    %identifier = $2-
  }
  else {
    %out = / $+ $2-
    %identifier = $2-
  }
  !set -l %time $ticks
  while (%before) !dec %before
  !set -l %before $ticks - %time
  if (%command != $null) {
    !set -l %time $ticks
    while (%main) {
      [ [ %command ] ]
      !dec %main
    }
    !set -l %main $ticks - %time
  }
  elseif (%multi != $null) {
    !set -l %time $ticks
    while (%main) {
      !scid %cid %multi
      !dec %main
    }
    !set -l %main $ticks - %time
  }
  else {
    !set -l %time $ticks
    while (%main) {
      !noop [ [ %identifier ] ]
      !dec %main
    }
    !set -l %main $ticks - %time
  }
  !set -l %time $ticks
  while (%after) !dec %after
  !set -l %after $ticks - %time
  var %total = %before + %after
  echo -qgace info First loop: %before $+ ms - Second loop: %after $+ ms - A total of $&
    %total $+ ms for $calc(2 * %i) trivial cycles ( $+ $calc(%total / 2 / %i) $+ ms per cycle)
  linesep -a
  echo -gac info2 Results for $1 cycles of: %out 
  echo -gac info2 %main $+ ms for $1 cycles ( $+ $calc(%main / $1) $+ ms per cycle) - Speed factor: $&
    $calc((%main / $1) / (%total / %i))
  linesep -a
}


it is important to minimize the overhead involved when performing the actual benchmark (while at the same time remaining pragmatic and considering differences on the order of what is actually measurable) which is why some of the code may look a little funny.