Care to back that up with some facts ? I will test it tonight, but I'm fairly certain one while is gonna be a lot faster than 2 if statements and matching goto's

update: tested with the code below

my while loop (test1) returns 24280 ticks
your goto loop (test2) returns 31664 ticks

Note that the code is virtually similar to what we posted above, including if statements and goto's.

I dare conclude that my while loop is faster

Code:
alias test1 {
  set %ticks $ticks
  var %x = 50000
  while (%x) {
    if (%x >= 0) echo -a test %x
    dec %x
  }
  echo -a time taken: $calc($ticks - %ticks)
}

alias test2 {
  set %t alfa beta
  set %ticks $ticks
  var %x = 0
  :next
  inc %x
  if (%x > 50000) { goto finish }
  else {
    if (%x < 0) { goto next }
    elseif (%x > 0) { echo -a test %x | goto next }
  }
  :finish
  tokenize 32 %t
  echo -a time taken: $calc($ticks - %ticks)
}

Last edited by LocutusofBorg; 15/09/03 01:52 PM.