[Haskell-cafe] Re: Timers

Bulat Ziganshin bulatz at HotPOP.com
Thu Dec 15 16:51:19 EST 2005


Hello Joel,

Thursday, December 15, 2005, 2:42:03 PM, you wrote:

JR> Here's the latest and greatest version put together with Einar's help.

let's analyze execution of this thread. it has 2000-6000 events in his
Map with an expiration time in the range 0-60 sec. it sleeps half a second,
then wakes and finds/deletes minimal values from map until all events
which are within this half-a-second will be performed and then sleeps
again

if half-second precision of performing events is appropriate for you,
why don't use solution which holds all events for given second in one
list? you can use array of such lists, or map of lists, or even
ordered list of lists - it will contain only 60 elements at any time

the most advanced solution will be array used as round buffer, whose
size==maximal event timing

i still don't understand why timings of your events may be different.
you always say us that in each run timing is constant - 9 min, 1 min



-- 
Best regards,
 Bulat                            mailto:bulatz at HotPOP.com





More information about the Haskell-Cafe mailing list