[Haskell-cafe] Implementing computations with timeout

Simon Marlow simonmar at microsoft.com
Mon Jan 10 12:00:41 EST 2005


On 07 January 2005 22:17, Tomasz Zielonka wrote:

> On Fri, Jan 07, 2005 at 11:00:27PM +0100, Tomasz Zielonka wrote:
>> Hmmm, TMVar's seem to be significantly (ie. 6 times) faster than
>> MVars in some simple tests :) 
>> 
>> Is it expected?
> 
> If it is, we can reimplement MVars using STM, when STM becomes stable
> :) 

No, TMVars are quite a bit slower than MVars if you use the basic
takeMVar/putMVar ops.  However, if you use the safer withMVar/modifyMVar
combinators, then you'll probably find that performance is about the
same. A simple test I did comparing TChan with Chan came up with roughly
the same performance, and STM isn't really tuned yet.

Cheers,
	Simon


More information about the Haskell-Cafe mailing list