Timers (was Re: [Haskell-cafe] Optimizing a high-traffic network
architecture)
Joel Reymont
joelr1 at gmail.com
Thu Dec 15 05:46:55 EST 2005
One idea would be to index the timer on ThreadId and name and stick
Nothing into the timer action once the timer has been fired/stopped.
Since timers are restarted with the same name quite often this would
just keep one relatively big map in memory. The additional ThreadId
would help distinguish the timers and avoid clashes.
On Dec 15, 2005, at 10:41 AM, Joel Reymont wrote:
> After a chat with Einar on #haskell I realized that I would have,
> say, 4k expiring timers and maybe 12k timers that are started and
> then killed. That would make a 16k element map on which 3/4 of the
> operations are O(n=16k) (Einar).
>
> I need a better abstraction I guess. I also need to be able to find
> timers by id instead of by name like now since each bot will use
> the same timer name for the same operation. I should have starTimer
> return X and then kill the timer using the same X.
--
http://wagerlabs.com/
More information about the Haskell-Cafe
mailing list