[Haskell-cafe] Optimizing a high-traffic network architecture

Joel Reymont joelr1 at gmail.com
Thu Dec 15 04:54:53 EST 2005


On Dec 15, 2005, at 12:08 AM, Einar Karttunen wrote:

>> timeout = 5000000 -- 1 second
>
> Is that correct?

I think so. threadDelay takes microseconds.

> Here is a nice trick for you:

Thanks!

>> --- The filter expression is kind of long...
>> stopTimer :: String -> IO ()
>> stopTimer name =
>>     block $ do t <- takeMVar timers
>>                putMVar timers $
>>                        M.filterWithKey (\(_, k) _ -> k /= name) t
>
> And slow. This is O(size_of_map)

Any way to optimize it? I need timer ids so that I can remove a timer  
before it expires. And I need ClockTime as key to so that I don't  
have to wake up every second, etc.

	Joel

--
http://wagerlabs.com/







More information about the Haskell-Cafe mailing list