tadzik/MuEvent — Issue #1: lastrun timer should compensate cb runtime
Author: bbkr
Created: 2011-10-31 11:32:03+00:00
State: open

Currently by assigning "$e = clock();" in run-timers interval of the timer is shifted by time to run callback itself.

For example if you set interval = 1s and your &cb takes 0.5s:
* you expect per hour 3600 calls with 50% loop usage
* you get 2700 calls per hour with 0.25% loop usage

IMO more correct is to write $e += $e, even if new lastrun value is lower than current clock(). Overloading event loop is nasty (lastrun timer may be permanently behind clock()) but it helps to better utilize CPU.