The results of the speedtesting on REMOVE vs. scooping off the top attr are
in.
The winner is...
REMOVE!
SPEEDTEST.REMOVE
How long in seconds? ?10
82202 total loops
8220.2 per second
:SPEEDTEST.SCOOPOFF
How long in seconds? ?10
24338 total loops
2433.8 per second
Using the remove method, the program was able to read a record and process
the attributes 8,220 times per second, while the scoopoff came in a
miserable 2,434 per second, making REMOVE close to FOUR times faster than
scooping off. Thanks go to Allen Egerton, who obviously shares the same
first name as me, as well as the last initial.
Here's the code from the two speed test programs, in case anyone would care
to test their speed on this construct, or any for that matter. I picked
this up from a BASIC games book about 20 years ago. The most simplest form
of the speedtest program is at the end. When I execute that, I get
1,475,104 loops per second out of my 2.6 GHz P4. Woof! My first machine, a
Data General Nova 3 barely got 200 loops per second.
* Release
* CUSTOM
* SPEEDTEST - does what it sounds like
Version="~Ver=~7.0.1~10486474~"
OPEN '', 'CM' TO CM ELSE OPEN.ERROR<-1> = 'CM'
PRINT 'How long in seconds? ':;INPUT HL
START = TIME()
ENDING = START + HL
COUNTER = 0
LOOP
READ CM.REC FROM CM, '9999' ELSE STOP
CM.REC = CM.REC ;* Force the internal pointer
REM.A = 999 ;* Not done
LOOP WHILE REM.A NE 0
REMOVE A.FIELD FROM CM.REC SETTING REM.A
REPEAT
COUNTER += 1
IF TIME() GE ENDING THEN EXIT
REPEAT
PRINT COUNTER:' total loops'
PRINT COUNTER/HL:' per second'
STOP
Insert ON - AEE.BP - SPEEDTEST.REMOVE 1,1
* Release
* CUSTOM
* SPEEDTEST - does what it sounds like
Version="~Ver=~7.0.2~8354011~"
OPEN '', 'CM' TO CM ELSE OPEN.ERROR<-1> = 'CM'
PRINT 'How long in seconds? ':;INPUT HL
START = TIME()
ENDING = START + HL
COUNTER = 0
LOOP
READ CM.REC FROM CM, '9999' ELSE STOP
A.COUNT = DCOUNT(CM.REC,@AM)
FOR K = 1 TO A.COUNT
A.VALUE = CM.REC<1>
DEL CM.REC<1>
NEXT K
COUNTER += 1
IF TIME() GE ENDING THEN EXIT
REPEAT
PRINT COUNTER:' total loops'
PRINT COUNTER/HL:' per second'
STOP
Insert ON - AEE.BP - SPEEDTEST.SCOOPOFF 1,1
* Release
* CUSTOM
* SPEEDTEST - does what it sounds like
Version="~Ver=~7.0.2~3025449~"
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
Allen E. Elwood
Senior Programmer Analyst
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 Allen E. Elwood
Sent: Tuesday, October 26, 2004 16:34
To: [EMAIL PROTECTED]
Subject: RE: [U2] [UD] Exit BASIC program with SELECT list?
Ohh.....lemme see, could it be that I've never heard of REMOVE? :-D
Oh boy a new toy to play with. I'll give it a whirl in my speedtest program
and see which is more efficient!!!
News at 11 !
-------
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/