Re: Why are intepreters so slow today
Stan Bailes (stan@stan.asd.sgi.com)
18 Apr 1994 22:30:59 GMT
In article <weg.766696559@mace.cc.purdue.edu>,
Eythan Weg <weg@mace.cc.purdue.edu> wrote:
>I think this answer is not pertinent. When you have to loop
>unconditionally you may want to do this (in J) like
>
> >: ^: 1000000 (0)
>
>which is equivalent to the C expression. As for speed, check it
>yourself. You will be surprised.
>
I tried this (in J 6.2 and J 7) and *was* suprised at how slow
it was (~75 sec on 100Mhx SGI Indy SC).
The expression:
+/1000000 $ 1
was much faster (~.3 sec)
Even /bin/ksh was faster... (~64 sec)
#!/bin/ksh
integer i=0
while (( i < 1000000 )); do
(( i = i + 1 ));
done
print $i
--
Stan Bailes e-mail: stan@sgi.com
Silicon Graphics, Mountain View, CA voice: (415) 390-1995