Be careful of consecutive speed tests. With memory caching and virtual
memory, the second process benefits from the first process loading and/or
leaving data in memory.

That may invalidate your victory if the second test won.

My 1 cent.

P.S. The GOTO Holy war will never end until it's removed from the compiler
and that ain't gonna happen.


----- Original Message -----
From: "Allen E. Elwood" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, December 13, 2004 12:36 PM
Subject: RE: [U2] LOOP or GOTO on READNEXT


> Hi Karl,
>
> Thank you for asking that question, 'cause funny as it sounds I never
> thought to do a speed test on this construct.
>
> 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!!!!!!  LOOP/REPEAT came out at 15.9 Million loops per second while
GOTO
> came out at 14.3 MLPS.  This running on a 2.6ghz P4 w2000 install of
Unidata
> PE.
>
> (Notice I also prefer the EXIT statement in environments that have it)
>
> I actually thought that the GOTO would win, but it appears that the P-code
> processor has been optimized to work faster with loop constructs.
>
> So does this end the GOTO holy war?
> Less Filling, Tastes Better, Goes Faster???
>  ;-)
>
> SPEEDTEST.GOTO
> How long in seconds? ?10
> 14369777 total loops
> 1436977.7 per second
> PC:
>
> SPEEDTEST
> How long in seconds? ?10
> 15921613 total loops
> 1592161.3 per second
> PC:
>
> * Release
> * CUSTOM
> * SPEEDTEST - does what it sounds like
> PRINT 'How long in seconds? ':;INPUT HL
> START = TIME()
> ENDING = START + HL
> COUNTER = 0
> LOOP
>   COUNTER += 1
>   IF TIME() GE ENDING THEN EXIT
> REPEAT
> PRINT COUNTER:' total loops'
> PRINT COUNTER/HL:' per second'
> STOP
>
> * Release
> * CUSTOM
> * SPEEDTEST.GOTO - does what it sounds like
> PRINT 'How long in seconds? ':;INPUT HL
> START = TIME()
> ENDING = START + HL
> COUNTER = 0
> 10
>   COUNTER += 1
>   IF TIME() GE ENDING THEN GOTO 20
> GOTO 10
> 20
> PRINT COUNTER:' total loops'
> PRINT COUNTER/HL:' per second'
> STOP
>
> Allen E. Elwood
> Senior Programmer Analyst
> Sysmark Information Systems, Inc.
> Direct (818) 361-5251
> Fax    (818) 361-5251
> Cell    (818) 359-8162
> Home (818) 361-7217
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of
> [EMAIL PROTECTED]
> Sent: Monday, December 13, 2004 07:33
> To: [EMAIL PROTECTED]
> Subject: [U2] LOOP or GOTO on READNEXT
>
>
> I've seen 2 ways to read a client key, change the length to 6 digits, then
> write it back out, delete the old one and move on:
>
> EXAMPLE 1 of 2:
> !(FIXEMPNO) - Fix the employee number length
>       open '','CUSTEMP' to CF else stopm 'Not'
>       select CF
> 10:   readnext K else stop
>       read REC from CF,K then
>          NK = fmt(K,"R%6")
>          write REC on CF,NK
>          delete CF,K
>       end
>       go 10
>    end
>
> EXAMPLE 2 of 2:
> !(FIXEMPNO) - Fix the employee number length
>       DONE = 0
>       open '','CUSTEMP' to CF else stopm 'Not'
>       select CF
>       loop
>          readnext K else DONE = 1
>       read REC from CF,K then
>          NK = fmt(K,"R%6")
>          write REC on CF,NK
>          delete CF,K
>       end
>       repeat
>    end
>
> My intent is not to start a religious discussion about GO or GOTOs because
> I see that method all over the place and regardless of why, who or
> whatever, my question is, which is faster. (I prefer using loop..repeat
> syntax, FWIW).
>
> --
> Karl L. Pearson
> Director of IT,
> ATS Industrial Supply
> Direct: 801-978-4429
> Toll-free: 800-789-9300 1,29
> Fax: 801-972-3888
> http://www.atsindustrial.com
> [EMAIL PROTECTED]
> -------
> u2-users mailing list
> [EMAIL PROTECTED]
> To unsubscribe please visit http://listserver.u2ug.org/
> -------
> u2-users mailing list
> [EMAIL PROTECTED]
> To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to