I'm of those who think that using brackets renders clearer and 'simpler' code if the latters are not excessively used.

While reading this thread, i've decided to benchmark the issue. Here's the rough benchmarking code.

Some people may be surprised when seeing the results.

Code:
; Benchmarking brackets ...
; 08.11.2007 @20hr54 by tropnul
; usage: /testcore

alias test1 {
  If 1 <= 2 noop
}

alias test2 {
  If (1 <= 2) noop
}

alias test3 {
  If 1 <= 2 { noop }
}

alias test4 {
  If (1 <= 2) { noop }
}

alias test5 {
  If 1 <= 2 noop | noop
}

alias test6 {
  If (1 <= 2) noop | noop
}

alias test7 {
  If 1 <= 2 { noop | noop }
}

alias test8 {
  If (1 <= 2) { noop | noop }
}

alias test9 If 1 <= 2 noop | noop

alias test10 If (1 <= 2) noop | noop

alias test11 If 1 <= 2 { noop | noop }

alias test12 If (1 <= 2) { noop | noop }

alias testproc {
  Var %z = 5000
  Set %t $ticks
  While %z {
    $1
    Dec %z
  }
  Var %t' = $calc($ticks - %t)
  Set %f %f test $+ $remove($1,test) $+ : $+(%t',ms)
}

alias testcore {
  Var %i = 1
  While (%i <= 12) {
    noop $testproc(test $+ %i)
    inc %i 
  }
  Echo -at %f
  Unset %t , %f
}


Without saying anything about the results (I'll let you test it ;)), I must say that my opinion didn't change after doing the benchmarking. I still believe that 'using brackets renders clearer and 'simpler' code if the latters are not excessively used.'

Regards

Last edited by TropNul; 08/11/07 05:35 PM.