Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Constants and SYS(5) + SYS(2003)
Message
De
26/09/1999 01:23:52
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00267724
Message ID:
00269035
Vues:
39
Hi George,

>#DEFINE SHORT_STRING "AAAAA"
>
>lcshort = "AAAAA"
>lnstart = SECONDS()
>FOR lni = 1 TO 100000
>  lcfoo = SHORT_STRING
>NEXT
>lnstop = SECONDS()
>? lnstop - lnstart
>lnstart = SECONDS()
>FOR lni = 1 TO 100000
>  lcfoo = lcshort
>NEXT
>lnstop = SECONDS()
>? lnstop - lnstart
>lnstart = SECONDS()
>FOR lni = 1 TO 100000
>  lcfoo = "AAAAA"
>NEXT
>lnstop = SECONDS()
>? lnstop - lnstart
You didn't peek down here, did you?< bg > OK, here's what I'll bet you saw: Each time you ran it, the first loop was fastest, the next fastest was the last, and the slowest was the second loop. However, if you replace the defined constant with REPLICATE("A", 5), the first instance will drop to the slowest because it's being re-evaluated on each pass.


Interesting aside here, George ... I got different results with this when run under FPW 2.6 rather than VFP. And the results were inconsistent ... the order of fastest to slowest was different each time you ran it. Care to hazard a guess as to why?? I have no idea .....

-Bonnie
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform