Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VERY STRANGE: performance diff in SKIP and SCAN
Message
De
23/06/2003 09:41:04
 
 
À
23/06/2003 09:10:18
Walter Meester
HoogkarspelPays-Bas
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00802848
Message ID:
00802882
Vues:
24
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform