Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ISSUE: uses LOOP for faster loop cycles
Message
De
30/04/2005 13:56:53
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
ISSUE: uses LOOP for faster loop cycles
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
01009925
Message ID:
01009925
Vues:
74
CLEAR
T0=SECONDS()
FOR K=1 TO 10000000
NEXT
T00=SECONDS()-T0
T0=SECONDS()
FOR K=1 TO 10000000
	IF .T.
	ELSE
	ENDIF
NEXT
T11=SECONDS()

FOR K=1 TO 10000000
	IF .T.
		LOOP
	ELSE
		LOOP
	ENDIF
NEXT
T12=SECONDS()

FOR K=1 TO 10000000
	DO CASE
	CASE .T.
	OTHERWISE
	ENDCASE
NEXT
T23=SECONDS()

FOR K=1 TO 10000000
	DO CASE
	CASE .T.
		LOOP
	OTHERWISE
		LOOP
	ENDCASE
NEXT
T24=SECONDS()


? "IF   "	,T11-T0-T00		AT 10	,T12-T11-T00
* 40-50% SPEED GAIN"
??	TRANSFORM(((T11-T0-T00) /(T12-T11-T00)-1)*100	,"@R LOOP SPEED GAIN 99 %") AT 50
? "CASES "	,T23-T12-T00	AT 10	,T24-T23-T00
* 60-70% SPEED GAIN"
??	TRANSFORM(((T23-T12-T00)/(T24-T23-T00)-1)*100	,"@R LOOP SPEED GAIN 99 %") AT 50
With a more complex compiler, VFP can implement the loop optimization.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform