quoting all names, the mystery (was Re: [ANN] News Reader Stack Available)

J. Landman Gay jacque at hyperactivesw.com
Thu Jul 3 14:53:00 EDT 2003


On 7/3/03 1:15 PM, Alex Rice wrote:

> But I ran my own test and can't discern any noticeable difference. 
> Sometimes quoted literals is faster, sometimes unquoted literals is 
> faster. The Hypertalk Book is so clear about this. Maybe we are not 
> writing correct benchmarks?
> 

Okay, I got curious. I revised Dar's original script, which contained no 
repeats, to include a long repeat loop:

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
   repeat 100000
     put the highlight of button "dummy" into x
   end repeat
   put the long seconds into tEnd
   put (tEnd - tStart - tCorrection) & " s quoted" & LF after field "Report"
   put the long seconds into tStart
   repeat 100000
     put the highlight of button dummy into x
   end repeat
   put the long seconds into tEnd
   put (tEnd - tStart - tCorrection) & " s unquoted" & LF after field 
"Report"
end mouseUp

I get consistent results -- quoted names are faster. A representative 
time value on my Mac G4 is:

1.086114 s quoted
1.335501 s unquoted

Granted, that's a lot of repeats and for single-event access it isn't 
going to make any difference. For long repeat loops though, it could.


-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list