Allen E. Elwood <[EMAIL PROTECTED]> wrote on 13 Dec 2004 09:36:42 -0800
> I didn't include the delete statement because what you
> really wanted to test was the LOOP/REPEAT vs. the GO
> construct. Guess what? After doing four consecutive runs
> and picking the fastest of each four, LOOP/REPEAT wins!!!!!!
> ...
> So does this end the GOTO holy war?
> Less Filling, Tastes Better, Goes Faster???
> ;-)
Ummm... no. Using UniData 6.0 on AIX 5.1 I tested a similar program with a
tighter GOTO loop:
01: * Test Loop Speeds
02: *
03: CTR = 0
04: ETIME = TIME() + 5
05: LOOP WHILE TIME() < ETIME DO
06: CTR += 1
07: REPEAT
08: PRINT "While ":CTR
09: *
10: CTR = 0
11: ETIME = TIME() + 5
12: 10 CTR += 1
13: IF TIME() < ETIME THEN GOTO 10
14: PRINT "Go To ":CTR
I also wrote a separate program with lines 2-9 above after line 14, so I
could test if the order of execution made a difference. I ran each program
four times, with the following results ("W" indicates "Winner" :->)
------ Go To First ----- ------ While First -----
Go To Count While Count Go To Count While Count
----------- ----------- ----------- -----------
769730 W 752380 667050 W 458545
655809 734709 W 747373 W 592827
576565 688953 W 785676 W 611628
629807 748265 W 714679 W 564908
The second loop for whatever reason seems to have an advantage. Overall, I
suspect there isn't a lot of difference.
--Tom Pellitieri
Century Equipment
-------
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/