Stack Level Local/Globals

Eric Chatonet eric.chatonet at sosmartsoftware.com
Mon Jul 4 17:23:45 EDT 2005


Hi Dave,

I am sure you are right but I was thinking in a practical way.
Most globals are not hundreds of elements.
Often a Boolean value is enough (at the very worst a dozen of lines).
Then it does not seem *practically* significant if it takes 20/1000  
of 1 millisecond instead of 1/1000 of 1 millisecond :-)

Here is a tiny test I have just made:

on mouseUp
   global gTest
   put true into gTest
   put the milliseconds into tStart
   repeat 1000
     put gTest into temp
   end repeat
   put the milliseconds - tStart
end mouseUp

 > 1 millisecond for 1000 loops

on mouseUp
   put the milliseconds into tStart
   repeat 1000
     put the uTest of me into temp -- contains "true"
   end repeat
   put the milliseconds - tStart
end mouseUp

 > 15 milliseconds for 1000 loops.
Very bad indeed but in fact not at all significant ;-)

Le 4 juil. 05 à 22:59, Dave Cragg a écrit :

> Eric, my own testing shows that accessing custom properties is  
> significantly slower than accessing globals. (Over 20 times slower  
> in a simple test.) When I have to refer to custom properties  
> frequently (for example when going through hundreds of elements of  
> a customPropertySet), I usually copy them to a variable first. But  
> perhaps the access times vary by circumstances.

Best Regards from Paris,

Eric Chatonet.
----------------------------------------------------------------
So Smart Software

For institutions, companies and associations
Built-to-order applications: management, multimedia, internet, etc.
Windows, Mac OS and Linux... With the French touch

Free plugins and tutorials on my website
----------------------------------------------------------------
Web site        http://www.sosmartsoftware.com/
Email        eric.chatonet at sosmartsoftware.com/
Phone        33 (0)1 43 31 77 62
Mobile        33 (0)6 20 74 50 86
----------------------------------------------------------------




More information about the use-livecode mailing list