On 6/19/03 1:15 AM, Dar Scott wrote:


On Wednesday, June 18, 2003, at 11:08 PM, Chipp Walters wrote:


I'm with Jacqueline. I always thought it took the interpreter longer to
figure out what it's looking at.

...


Has anyone else any
thoughts on the wisdom or otherwise of quoting all names?


I believe there is a slight speed hit if you don't use quotes, since the
engine has to figure out whether the word is a variable or a name.


A quick test on OS X seems to indicate that is not the case:

on mouseUp
local x
set the numberFormat to "0.000000"
put empty into field "Report"
put the long seconds into tEnd -- throw this one away
put the long seconds into tStart
put the long seconds into tEnd
put tEnd-tStart into tCorrection
put the long seconds into tStart
put the highlight of button "dummy" into x
put the long seconds into tEnd
put (tEnd - tStart - tCorrection) & " s quoted" & LF after field "Report"
put the long seconds into tStart
put the highlight of button dummy into x
put the long seconds into tEnd
put (tEnd - tStart - tCorrection) & " s unquoted" & LF after field "Report"
end mouseUp


Typical results:

0.000025 s quoted
0.000026 s unquoted

I would guess that the script compiler checks to see whether the name was used as a variable so for in the script. If it has, it would compile a variable use. If not, it would compile the same as a string.

If there is a real difference is is one or two microseconds on my computer.

I ran your script on my Mac G4/350:


0.000031 s quoted
0.000053 s unquoted

on my G4 12" PB:

0.000033 s quoted
0.000057 s unquoted

So, about twice as long if unquoted, though still not a huge amount of time. If the test were run on older machines, I suspect there would be greater variance.

This reminds me of some speed tests that a HyperCard user did a few years ago. The HyperCard manual gave several tips on how to improve performance. Using the newest Mac available at the time, he ran extensive tests on each tip and concluded that there were no advantages to using the suggested techniques. However, when I re-ran his tests on a few of my old Macs (one of them the original SE) there was a difference in speed that could be measured in seconds, and in one case, minutes.

Because I don't know what machines my users will be running, I always quote names. I also use a few other speed tips routinely, partly out of habit, but also because I never know how much difference it may make to my users. I suppose in this day and age it doesn't matter much any more, but these habits feel like good ones to me in general so I keep them.

--
Jacqueline Landman Gay         |     [EMAIL PROTECTED]
HyperActive Software           |     http://www.hyperactivesw.com

_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to