Most Efficient Timer?

Dar Scott dsc at swcp.com
Mon Nov 29 14:27:15 EST 2004


On Nov 29, 2004, at 1:00 AM, Scott Rossi wrote:

> "Can you script a more efficient timer?"

Here are some overhead times on my system:

Time to "send in time":                                 10 ns
Time to use an empty custom command:                    34 ns
Time to process an _additional_ empty pending message:  21 ns

The last time applies if more than one message is ready.  I'm not sure 
about this one.  It seems to be nonlinear; adding a pending message 
might increase the time 0 ns or 100 ns.

It looks to me that using "send in time" is efficient.

One approach to making a timer more efficient is to minimize when the 
field is updated.  It takes about 1.5 ms to update a field.  It takes 
1.7 ms to update a field and then unlock the screen.  Here are some 
ideas:

      Only update a field if the new value is not the same as the 
previous.
      Calculate the delay each time to make the next scheduled time at 
100 ms after the second.
      Do not update if the number of pending messages is greater than 
some amount.

Even though it might take more time, you might want to experiment with 
unlocking the screen after an update.

Dar


****************************************
     Dar Scott Consulting
     http://www.swcp.com/dsc/
     Programming Services
****************************************



More information about the use-livecode mailing list