Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Which command would execute faster? Seek & Do while or S
Message
From
29/03/2006 07:21:45
Mike Yearwood
Toronto, Ontario, Canada
 
 
To
28/03/2006 21:32:29
Sonny Tabano
Trams Printwork, Inc.
Mabalacat, Philippines
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01108228
Message ID:
01108732
Views:
19
>Hi Mike,
>
>Thanks for the advice on using the m.lcVar instead of "&". I'm used to using it (&) in clipper programming, but now I know it has different results with VFP9. Just wondering what's the use of "m." in m.lcVar?
>
>Thanks again and I hope I'm not asking too much for advices. All your help are greatly appreaciated.
>

m.lcVar returns the content of the variable.
&lcVar compiles the variable.

Using & for such simple stuff is terrible!!!! and if I'm not mistaken it was similarly bad in Clipper. There are very few places where & is necessary. Find out what those are and only use it in those cases. Otherwise avoid it like whatever horrible disease most scares you.
lcVar = "00008"

a=SECONDS()
FOR m.x = 1 TO 100000
  m.c=&lcVar
ENDFOR
?SECONDS()-m.a
?m.c

a=SECONDS()
FOR X = 1 TO 100000
  m.c=m.lcVar
ENDFOR
?SECONDS()-m.a
?m.c
Try that code. Pay attention to the content of m.c after the & version. It is not the same as m.c after the second version.

On my machine the & version is 7 times slower than the m.

HTH
Previous
Reply
Map
View

Click here to load this message in the networking platform