Quoted or unquoted literals

Brian Yennie briany at qldlearning.com
Tue May 12 12:51:31 EDT 2009


I'm a bit skeptical that any such difference actually exists. Both the  
short and long forms should map to the exact same compiled code.  
Theoretically the long form would take longer to parse / compile the  
first time, but we're talking about the parsing of individual  
characters -- something that would have immeasurably small impact.

When I run the benchmark, the faster method seems to depend on a  
combination of which one appears first in the script and/or the  
direction of the wind, and doesn't appear to be repeatable.

> René Micout wrote:
>> Jacqueline,
>> You said yesterday (?) that using synonym like "cd", "btn", "fld"  
>> is  slower than "card", button", "field". That is, I think, an   
>> interesting problem because I use synonym every time...
>> What is the difference (speed) ?
>
> Not enough to bother with, IMO.
>
> I ran this test:
>
> on mouseUp
> put 100000 into n
> --  Abbrev:
> put the millisecs into t
> repeat n
>   set the uX of sb 1 to the text of fld 1
> end repeat
> put the millisecs - t into t1
> -- Full:
> put the millisecs into t
> repeat n
>   set the uX of scrollbar 1 to the text of field 1
> end repeat
> put the millisecs - t into t2
> --
> put "Abbrev: "& t1/n && "  Full: "& t2/n &\
>     cr& "Difference: "& t1/n - t2/n
> end mouseUp
>
> ...and got this result:
>
> Abbrev: 0.00213   Full: 0.00211
> Difference: 0.00002
>
>
> I'm normally quick to adopt habits which will optimize performance,  
> knowing that every clock cycle saved is one I can put toward bullet- 
> point features, but on this one the productivity loss of typing the  
> full form for all object references isn't worth the 0.00002  
> millisecond to me.
>
> No doubt this difference would be much greater if one were doing  
> this in a "send", "do" or "value" call because those need to run  
> through the compiler in each iteration.  But for that reason I use  
> those as seldom as possible anyway;  the overhead of using "send" is  
> orders of magnitude more than the overhead of using abbreviations.
>
> It's still not the end of the world to use "send", and when you need  
> it you need it.  But avoiding "send", "do", or "value" where  
> practical will save you much more time than avoiding abbreviations.
>
> Besides, with "dispatch" and behaviors in v3.5 I rarely use "send"  
> these days.  "Dispatch" is similar to send in many ways, and AFAIK  
> it still needs to be runtime-compiled, but something about it is  
> optimized so that it benchmarks at least 30% faster.



More information about the use-livecode mailing list