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 09:41:04
 
 
To
23/06/2003 09:10:18
Walter Meester
HoogkarspelNetherlands
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00802848
Message ID:
00802882
Views:
22
Not really, here's an excerpt from the help

Note that execution speed can be degraded when SET TALK is set to ON, because the main Visual FoxPro window or user-defined window must be frequently updated

SKIP and LOCATE both TALK whereas SCAN does not

>Yes, that's it....
>
>Still strange though.....
>
>Walter,
>
>
>>Perhaps
>>
>>set talk off
>>
>>will give a different result
>>
>>>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,
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform