Quoted or unquoted literals
Richmond Mathewson
richmondmathewson at gmail.com
Tue May 12 12:59:43 EDT 2009
Well, as an educational content deliverer I try to make my programs run
no faster than the
brains of my pupils/students; mind you, in certain cases that is
glacially slow. :)
Years ago, on my Performa 475 things were great, I had time to takes
gulps of coffee
between sentences in my Master's thesis (i.e. waiting for the stuff I
had typed in
Clarisworks to show up on the screen); now I have to have a silly
program that tells
me when to take a break!
And, I always use "btn", "img", "gc" and "fld", but "card" - don't quite
know why,
but I find "cd" confuses me. Now that I find that using short-forms
(err, or is it the other
way round) is going to make my stacks a milli-microsecond faster I will
reform
myself, needless to say.
Brian Yennie wrote:
> 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.
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
More information about the use-livecode
mailing list