Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VERY STRANGE: performance diff in SKIP and SCAN
Message
From
23/06/2003 08:44:36
Walter Meester
HoogkarspelNetherlands
 
 
To
23/06/2003 08:15:22
Walter Meester
HoogkarspelNetherlands
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00802848
Message ID:
00802860
Views:
23
Follow up....

I tested this on various machines:

- P4 2Ghz 512 Mb
- AMD XP 1800+
- PII 266 Mhz.

The strange thing is that SKIP runs faster on my PII 266 Mhz than on the other two. In this case the SKIP is performing better than SCAN NEXT 2. Very very strange.....

Tested in VFP 6, VFP 7 and VFP 8.

Walter,




>Hi John / all,
>
>While optimizing a piece of loop intensive code I discovered the following:
>
>SKIP is about 30 times SLOWER than the SCAN NEXT 2 .. ENDSCAN equivalent
>
>I can't see for SCAN NEXT 2 is different in functionality compared with skip. I've tried other commands like LOCATE NEXT 2 FOR .F., COUNT NEXT 2 FOR .F., etc, but they all are about 30 times slower than the SCAN NEXT alternative.
>
>What am I missing? Can someone please explain?
>
>See for yourself with the following example
>
>CREATE CURSOR Test (Dummy C(1))
>APPEND BLANK
>APPEND BLANK
>APPEND BLANK
>
>nSec=SECONDS()
>FOR nT = 1 TO 100000
>	GO 1
>	SKIP
>ENDFOR
>
>WAIT WINDOW "Next record with SKIP: "+STR(SECONDS()-nSec,10,3)
>nSec=SECONDS()
>
>FOR nT = 1 TO 100000
>	GO TOP
>	SCAN NEXT 2
>	ENDSCAN
>ENDFOR
>WAIT WINDOW "Next record with SCAN NEXT 2: "+STR(SECONDS()-nSec,10,3)
>
>*-
>
>nSec=SECONDS()
>FOR nT = 1 TO 100000
>	GO BOTT
>	LOCATE REST FOR EOF()
>ENDFOR
>
>WAIT WINDOW "go to EOF() with LOCATE: "+STR(SECONDS()-nSec,10,3)
>nSec=SECONDS()
>
>FOR nT = 1 TO 100000
>	GO BOTT
>	SCAN REST WHILE !EOF()
>	ENDSCAN
>ENDFOR
>WAIT WINDOW "go to EOF() with SCAN REST: "+STR(SECONDS()-nSec,10,3)
>
>
>Walter,
Previous
Reply
Map
View

Click here to load this message in the networking platform