From: Michael R. <mi...@re...> - 2012-03-25 13:57:41
|
Hi Mattia, nice to read you! again, I#ll comment just one part of your mail: > First, all timers are stored in a malloc'ed > vector that is reallocated every time a new slot is required. This is > absolutely sub-optimal even when handling a handful of timers. The > memory where slots are allocated is forced to be contiguous and there > is no need for that. When no contiguous memory is available, realloc > has to copy all pointers from the old location to the new one. Not to > mention the fact that timers are added in a random order, filling the > first available slot. I slightly disagree: normally there is a fixed number of timers used, and these timers are allocated at or very short after initialization of the layout. as soon as the maximum of timers are in use, no more realloc() should occur, even if timers are recreated (for one-shot timers). In case of a recreation, a already allocated but available slot will be reused. For all the discussions, please keep one aspect in mind: the "delay" value of every timer normally is a "property", that means that it is an expression, which is evaluated regularly, and its value may change during runtime. think of an expression like this: "is_working_hour() ? 50 : 2000" regards, Michael -- Michael Reinelt <mi...@re...> http://home.pages.at/reinelt GPG-Key 0xDF13BA50 ICQ #288386781 |