Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Constants and SYS(5) + SYS(2003)
Message
From
26/09/1999 01:23:52
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00267724
Message ID:
00269035
Views:
41
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform