use-revolution digest, Vol 1 #1154 - 7 msgs
Richard Gaskin
ambassador at fourthworld.com
Wed Feb 26 17:19:01 EST 2003
David Vaughan wrote:
> I personally find this a strange discussion. Firstly, I would rather be
> warning newbies if local variables did *not* lose their value on
> recompilation, and secondly, why write code to emulate some features of
> custom properties when you can use them directly? If you need that
> millisecond of speed by which access to a local is faster than to a
> custom prop then use your startup, preopen or open handler to populate
> the script locals from the custom properties, and save back the values
> at end, to cater for changes. Through use of custom props, script
> locals and ordinary variables, I have been able to relegate globals to
> very rare usage, when you actually want a non-persistent entirely
> global variable. Rev is quite rich in scoping and persistence options.
<OCD mode>
Benchmarking the difference between local vars and custom props with RevBnch
(downloadable from <http://www.fourthworld.com/rev/>), here's the results:
SCRIPT 1
put "value" into tMyVar
get tMyVar
0.0002 ticks per iteration
SCRIPT2
set the uMyProp of this cd to "value"
get the uMyProp of this cd
0.0008 ticks per iteration
So while using local vars is about 75% faster, the real-world difference in
runtime execution is trivial compared to the cost savings in developmewnt
time that can be had by binding data to objects.
To be honest, the Rev/MC engine is so darn fast that I rarely do this sort
of comparative benchmarking anymore, as I often find -- as with this case --
that the runtime differences are negliible.
</OCD mode>
--
Richard Gaskin
Fourth World Media Corporation
Developer of WebMerge 2.2: Publish any database on any site
___________________________________________________________
Ambassador at FourthWorld.com http://www.FourthWorld.com
Tel: 323-225-3717 AIM: FourthWorldInc
More information about the use-livecode
mailing list