Re: voting on GOTO
- Posted by c.k.lester <euphoric at c?l?ster.com> Jun 06, 2008
- 798 views
Jim Brown wrote: > > 9,999,999 function calls is about 2 seconds. 99,999,999 gotos is <1 second. While that kicks total butt, I have to wonder who calls a function almost 10 million times? Just curious. I'm sure Kat with her processing of gigabytes of text probably makes use of some lines of code many many times... Kat? > w/o goto > > function factorial(atom a) > if a < 3 then > return a > end if > return a*factorial(a-1) > end function > > w/ goto > > function factorial(atom a) > stom b > b = a > > label "start" > a = a - 1 > > if a <= 2 then > goto "end" > end if > > b = b * a > goto "start" > > label "end" > return b > end function Would it be possible for you to benchmark those two functions?