Why is dispatch so fast?

Glen Bojsza gbojsza at gmail.com
Mon Nov 11 22:11:36 EST 2013


Am I wrong but it looks like an "Implied on" is the fastest?

 *-- Test 3: Implied on*

   *put* the millisecs into t

   *repeat* n

      foo

   *end* *repeat*

   *put* the millisecs - t into t3

   *--*


On Mon, Nov 11, 2013 at 10:06 PM, Richard Gaskin <ambassador at fourthworld.com
> wrote:

> Mark Wieder wrote:
>
>  Saturday, November 9, 2013, 10:30:38 PM, Richard wrote:
>>
>>  Why is the dispatch command so much faster than do, send, or call?
>>>>
>>>
>>  The main difference appears to be send needs to parse the params
>>> from the string. Do obviously needs to be parsed on the fly too.
>>>
>>
>> Yes, it's the runtime parsing that slows these down.
>>
>
> Here's an example where the overhead should be the same, yet dispatch
> takes only 287 ms to do's 405 ms:
>
> on mouseUp
>    put 100000 into n
>    put "foo" into tCmd
>    --
>    -- Test 1: Do
>    put the millisecs into t
>    repeat n
>       do tCmd
>    end repeat
>    put the millisecs - t into t1
>    --
>    -- Test 2: Dispatch
>    put the millisecs into t
>    repeat n
>       dispatch tCmd
>    end repeat
>    put the millisecs - t into t2
>    --
>    put t1 && t2
> end mouseUp
>
> on foo
>    get 1+1
> end foo
>
>
> --
>  Richard Gaskin
>  Fourth World Systems
>  Software Design and Development for Desktop, Mobile, and Web
>  ____________________________________________________________
>  Ambassador at FourthWorld.com        http://www.FourthWorld.com
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list