Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Label on last page's footer
Message
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00614141
Message ID:
00614620
Views:
18
Hi Sergey,

I use EXECSCRIPT() only because I wasn't aware of the _VFP.SetVar() function until Larry pointed it out. But now that you've shown me the speed difference, I'll definately start using _VFP.SetVar().

Thanks,
Cathy


>>Hi Cathy,
>>
>>Is there any reason why you prefer using EXECSCRIPT() over _VFP.Setvar() siggested by Larry Miller ?
>
>Here's the result of the tests I ran
>
>Command                Time        # of itterations
>
>Execscript            1.693        100
>_VFP.Setvar           0.000        100
>
>Execscript           16.984       1000
>_VFP.Setvar           0.010       1000
>
>As you can see VFP.Setvar is much faster. It's understandable, because Execscript() has to write code to the file, compile it and run from the file. _VFP.Setvar on other hand is built-in method of _VFP object. In addition _VFP.Setvar can work with local variables.
>Here's the test code
lnMaxItter = 1000
>lnCount = 0
>lnStart = SECONDS()
>FOR i=1 TO lnMaxItter
>	EXECSCRIPT("lnCount = lnCount + 1")
>ENDFOR
>? "Execscript", SECONDS() - lnStart, lnCount
>
>lnCount = 0
>lnStart = SECONDS()
>FOR i=1 TO lnMaxItter
>	_VFP.Setvar("lnCount", lnCount + 1)
>ENDFOR
>? "_VFP.Setvar", SECONDS() - lnStart, lnCount
>
Cathy Pountney, Microsoft Visual FoxPro MVP
Memorial Business Systems, Inc. (www.mbs-intl.com)

My Website: (www.frontier2000.com)
My Blog: (www.cathypountney.blogspot.com)
My Book: The Visual FoxPro Report Writer - Pushing it to the Limit and Beyond
Free MSDN Article: What's New in the VFP 9.0 Report Writer
Free MSDN Article: The VFP 9.0 Report Writer In Action
Previous
Reply
Map
View

Click here to load this message in the networking platform