Call vs Send

Richard Gaskin ambassador at fourthworld.com
Fri Jun 10 01:06:59 EDT 2005


Dar Scott wrote:
> 
> On Jun 9, 2005, at 9:51 PM, Richard Gaskin wrote:
> 
>>> What are the relative timings of handlers in the message path vs. 
>>> handlers
>>> outside?
>>
>>
>> About twice as long, but as with many benchmarks with Transcript it 
>> hardly matters:  "twice as long" sounds like a big deal, but on my 
>> 1GHz G4 that's still less than a microsecond. :)
> 
> 
> Do you mean millisecond?
> 
> I find addition to be less than a microsecond, but a path call is 8 to 
> 15 microseconds for the 3rd invocation and up. A send or call takes 50 
> to 70 microseconds for the 3rd call and up.  (2 short parameters)
> 
> Maybe we should compare notes.
> 
> This is on a dual 1.25 GHz G4.

No, my bad: I slipped a digit.

My times were:

0.00336 0.00871

Using this script:

-- in button used to run the test:	
on mouseUp
   put 100000 into tMax
   --
   put the millisecs into t
   repeat tMax
     foo
     get the result & "world"
   end repeat
   put  the millisecs - t into t1
   --
   put the millisecs into t
   repeat tMax
     call "foo" of btn "test"
     get the result & "world"
   end repeat
   put  the millisecs - t into t2
   --
   put t1/tMax && t2/tMax
end mouseUp


-- in card and in btn "test":
on foo
   return "hello"
end foo


Even so, a 5 microsecond difference isn't bad for most needs, esp. 
considering how rarely one truly needs to use either "call" or "send".

-- 
  Richard Gaskin
  Fourth World Media Corporation
  ___________________________________________________________
  Ambassador at FourthWorld.com       http://www.FourthWorld.com


More information about the use-livecode mailing list