oops. Bit of a booboo there. I neither tested the flag, nor set it correctly. Must try harder.
It *should* have been:
;;[90000runs, flagged at 50000]
alias wtest2 {
var %ticks = $ticks,%i = 0
var %flag = $true
while (%i != 90000 && %flag) {
if (%i == 50000) { %flag = $false }
inc %i
}
return $calc(($ticks - %ticks))
}
This is still giving slower times for while over goto. I think it's to be expected - setting a flag means that it has to iterate over the loop one extra time and test both the condition and then the flag before it exits the loop.
wtest2 gtest1
while: 1.734 ~ goto: 1.687
while: 1.812 ~ goto: 1.702
while: 1.812 ~ goto: 1.687
while: 1.828 ~ goto: 1.733
while: 1.812 ~ goto: 1.718
while: 1.827 ~ goto: 1.687
while: 1.797 ~ goto: 1.702
while: 1.797 ~ goto: 1.702
while: 1.827 ~ goto: 1.687
while: 1.812 ~ goto: 1.687