At 9:52 AM -0500 10/18/00, roy crisman wrote:
>So, I thought I'd ask this question about programming style before I 
>spend too much time doing speed comparisons for myself.
>
>I'm writing a Toggle Button behavior that can also be used as the 
>ancestor of several different behaviors such as a Radio Button set, 
>and a Tree Button sort of set (clicking a node off turns off 
>nodes-leaves below it, clicking a node-leaf off turns on the parents 
>above it).
>
>The Toggle Button behavior I already have works just fine, but it 
>was written with properties being accessed just as pPropertyName, 
>and not as me.pPropertyName.  So I either need to copy the 
>properties it uses 'up' to the ancestor, or change the pProperty 
>references to me.pProperty.  It seems to me that the copyProps would 
>be more elegant and proper-OOP-technique.
>
>The toggles themselves probably aren't going to ever encounter speed 
>issues, but I believe that adopting a me.pProperty style could 
>result in slower performance than pProperty referencing, especially 
>if I adopt me.pProperty referencing for all property referencing in 
>the future so classes that I decide to use as ancestors don't have 
>to be changed.
>

I don't know the answer to your question, but I'm willing to make a 
guess.  I would bet that if you took a script and changed all 
references from pProperty to me.Property for all properties, that 
there would be no change in speed.

My reasoning is that all properties must belong to some object 
whether there is an explicit reference or not.  So when Director 
"compiles" your Lingo code to its internal byte code representation, 
it generates code to reference properties as an offset from some base 
object address.  If you use a property without an object reference, 
Lingo assumes that the base object is "me" in the code that is 
generated .  Therefore, the code that is generated would be identical 
for pProperty and me.pProperty.

Of course, I have no way to know if this is correct, but I'd be 
interested to hear if you do a speed test.

Irv
-- 
Lingo / Director / Shockwave development for all occasions.

        (Over two millions lines of Lingo code served!)

[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to