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 08:43:52
 
 
À
23/06/2003 08:15:22
Walter Meester
HoogkarspelPays-Bas
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00802848
Message ID:
00802859
Vues:
33
This message has been marked as the solution to the initial question of the thread.
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