EDIT #2: just noticed the first edit used long(er) COM/binvar name for regred2, so third's the charm:
Code:
alias regread1 {
  tokenize 1 HKEY_CURRENT_USER\SOFTWARE\mIRC\LastRun\
  if (!$com(rr)) .comopen rr WScript.Shell
  tokenize 32 $com(rr,RegRead,3,bstr,$1) $com(rr).result
  return $2-
}

alias regread2 {
  tokenize 1 HKEY_CURRENT_USER\SOFTWARE\mIRC\LastRun\
  if (!$com(rr)) .comopen rr WScript.Shell
  noop $com(rr,RegRead,3,bstr,$1) $com(rr,&r).result
  return $bvar(&r,1-).text
}


Quote:
20:47:31 * Starting "regread1" test: 50,000 times, 5 cycles.
20:47:34 * Cycle #1 done: 2234 ms (0.04468 ms/command)
20:47:36 * Cycle #2 done: 2281 ms (0.04562 ms/command)
20:47:38 * Cycle #3 done: 2250 ms (0.045 ms/command)
20:47:40 * Cycle #4 done: 2234 ms (0.04468 ms/command)
20:47:43 * Cycle #5 done: 2266 ms (0.04532 ms/command)
20:47:43 * Done: 5 cycles done in 11,265 ms, 2253 ms/cycle on average.
20:47:48 * Starting "regread2" test: 50,000 times, 5 cycles.
20:47:51 * Cycle #1 done: 2375 ms (0.0475 ms/command)
20:47:53 * Cycle #2 done: 2359 ms (0.04718 ms/command)
20:47:55 * Cycle #3 done: 2359 ms (0.04718 ms/command)
20:47:58 * Cycle #4 done: 2359 ms (0.04718 ms/command)
20:48:00 * Cycle #5 done: 2359 ms (0.04718 ms/command)
20:48:00 * Done: 5 cycles done in 11,811 ms, 2362.2 ms/cycle on average.




Click to reveal.. (A major mess)

regread1 tokenizes the result instantly, regread2 performs /noop, and then uses $bvar to get the result. It has to do more, which slows it down.

Code:
alias regread2 {
  tokenize 1 HKEY_CURRENT_USER\SOFTWARE\mIRC\LastRun\
  if ($com(rr)) .comclose rr
  .comopen rr WScript.Shell
  noop $com(rr,RegRead,3,bstr,$1) $com(rr,&r).result
  .comclose rr
  return $bvar(&r,1-).text
}

alias regread1 {
  tokenize 1 HKEY_CURRENT_USER\SOFTWARE\mIRC\LastRun\
  if ($com(rr)) .comclose rr
  .comopen rr WScript.Shell
  tokenize 32 $com(rr,RegRead,3,bstr,$1) $com(rr).result
  .comclose rr
  return $2-
}


Quote:

20:30:24 * Starting "regread1" test: 50,000 times, 5 cycles.
20:30:27 * Cycle #1 done: 2891 ms (0.05782 ms/command)
20:30:30 * Cycle #2 done: 2843 ms (0.05686 ms/command)
20:30:33 * Cycle #3 done: 2891 ms (0.05782 ms/command)
20:30:36 * Cycle #4 done: 2859 ms (0.05718 ms/command)
20:30:39 * Cycle #5 done: 2875 ms (0.0575 ms/command)
20:30:39 * Done: 5 cycles done in 14,359 ms, 2871.8 ms/cycle on average.
20:30:43 * Starting "regread2" test: 50,000 times, 5 cycles.
20:30:46 * Cycle #1 done: 2984 ms (0.05968 ms/command)
20:30:49 * Cycle #2 done: 2969 ms (0.05938 ms/command)
20:30:52 * Cycle #3 done: 2969 ms (0.05938 ms/command)
20:30:55 * Cycle #4 done: 3000 ms (0.06 ms/command)
20:30:58 * Cycle #5 done: 2953 ms (0.05906 ms/command)
20:30:58 * Done: 5 cycles done in 14,875 ms, 2975 ms/cycle on average.


Test alias:
Code:
alias test {
  if ($1 isnum 1-) { var %t = $1 | tokenize 32 $2- }
  else var %t = 1000
  if ($1 isnum 1-) { var %c = $1 | tokenize 32 $2- }
  else var %c = 5
  if (!$1) echo -at * ERROR: invalid input: Usage: /TEST [times] [cycles] <alias> 
  elseif ($isalias($1)) {
    echo -at * Starting $qt($1-) test: $bytes(%t,b) times, $bytes(%c,b) cycles.
    %test.cycle = 0
    %test.cycles = %c
    %test.times = %t
    %test.cmd = $1
    %test.total = 0
    .timertest -iom %c 500 test.cycle
  }
  else echo -at * ERROR: $qt($1) no such alias.
}

alias -l test.cycle {
  inc %test.cycle
  var %x = %test.times,%t $ticks
  while (%x) { %test.cmd | dec %x }
  tokenize 1 $calc($ticks -%t)
  inc %test.total $1
  echo -at * Cycle $chr(35) $+ $bytes(%test.cycle,b) done: $1 ms $b($calc($1 /%test.times) ms/command)
  if (%test.cycle == %test.cycles) {
    echo -at * Done: $bytes($v2,b) cycles done in $bytes(%test.total,b) ms, $calc(%test.total /$v2) ms/cycle on average.
    unset %test.*
  }
  :error
  if ($error) {
    echo -at * ERROR: an error occurred while executing a $qt(%test.cmd) test cycle: $error
    .timertest off
    unset %test.*
    reseterror
  }
}




EDIT: just realized I technically used the wrong aliases, so let's try again:
Code:
alias regread1 {
  tokenize 1 HKEY_CURRENT_USER\SOFTWARE\mIRC\LastRun\
  if (!$com(rr)) .comopen rr WScript.Shell
  tokenize 32 $com(rr,RegRead,3,bstr,$1) $com(rr).result
  return $2-
}

alias regread2 {
  tokenize 1 HKEY_CURRENT_USER\SOFTWARE\mIRC\LastRun\
  if (!$com(regread)) .comopen regread WScript.Shell
  noop $com(regread,RegRead,3,bstr,$1) $com(regread,&regread).result
  return $bvar(&regread,1-).text
}



Quote:
20:42:12 * Starting "regread1" test: 50,000 times, 5 cycles.
20:42:14 * Cycle #1 done: 2250 ms (0.045 ms/command)
20:42:17 * Cycle #2 done: 2218 ms (0.04436 ms/command)
20:42:19 * Cycle #3 done: 2219 ms (0.04438 ms/command)
20:42:21 * Cycle #4 done: 2235 ms (0.0447 ms/command)
20:42:23 * Cycle #5 done: 2219 ms (0.04438 ms/command)
20:42:23 * Done: 5 cycles done in 11,141 ms, 2228.2 ms/cycle on average.
20:42:28 * Starting "regread2" test: 50,000 times, 5 cycles.
20:42:31 * Cycle #1 done: 2375 ms (0.0475 ms/command)
20:42:34 * Cycle #2 done: 2359 ms (0.04718 ms/command)
20:42:36 * Cycle #3 done: 2359 ms (0.04718 ms/command)
20:42:38 * Cycle #4 done: 2390 ms (0.0478 ms/command)
20:42:41 * Cycle #5 done: 2359 ms (0.04718 ms/command)
20:42:41 * Done: 5 cycles done in 11,842 ms, 2368.4 ms/cycle on average.


Last edited by Dazuz; 10/08/16 05:50 PM.