FYI: writing to and reading from fields much faster than locals, globals or custom properties
Josh Mellicker
josh at dvcreators.net
Mon Feb 22 23:51:18 EST 2010
On Feb 19, 2010, at 8:52 PM, Jim Bufalini wrote:
> Josh Mellicker wrote:
>
>> Oops.
>>
>> I learned coding from an old guy in an alley, that's why. :-)
>>
>> When a handler is not event driven, but just looping, monitoring
>> something, and keeps calling itself, what is the proper term?
>
> Recursion or recursive. This is the same as a tight loop because the handler
> never ends until the recursive calling stops. Hence, without waits *with
> messages* you will have a sluggish GUI.
Just FYI, we were using:
if "monitorExternalProcess" is not in the pendingMessages then send "monitorExternalProcess" to me in 1 milliseconds
That's why I was calling it a "1 millisecond loop".
Since this only calls itself once at a time, it's not recursive, right?
> Also, you could easily hit the
> recursive limit if the condition you are looking for does not occur as you
> expect, and your program will crash.
>
> Use instead:
>
> send "<thisHandlerName>" to me in 1 millisecond
>
> This will solve all of your problems of allowing the GUI to be responsive
> and avoid hitting the recursion limit.
>
> One thing to be aware of though, in any case, of using *wait... with
> messages* or sending in time. The time factor is not absolute. If, for
> example, a handler that takes 10 milliseconds to execute is triggered then
> there will be 10 milliseconds between executions of your "in-time loops"
>
> Aloha from Hawaii,
>
> Jim Bufalini
>
> _______________________________________________
> 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