Comments on More SMP parallelism.TypePad2006-10-21T23:19:02Zaudreythttps://pugs.blogs.com/pugs/tag:typepad.com,2003:https://pugs.blogs.com/pugs/2006/10/more_smp_parall/comments/atom.xml/Sebastian Sylvan commented on 'More SMP parallelism.'tag:typepad.com,2003:6a00d83451e8fb69e200d834be673953ef2006-10-22T15:28:28Z2007-08-18T20:50:30ZSebastian SylvanThere are no "locks" per say here, so no reason to use TMVars. The only thing the MVars are used...<p>There are no "locks" per say here, so no reason to use TMVars. The only thing the MVars are used for here is to cause the consumer to block until the producer is done with all of the elements (which could be achieved by TMVars, but more expensively, at no improvement).</p>
<p>I also suggested (it seems I forgot to do "reply all" so it was off list) wrapping the takeMVar in unsafeInterleaveIO. This would allow you to, say, retrieve the result of element x while element y is still being computed (assuming x/=y and x is finished) since the blocking is deferred until you actually try to use the elements in the list. This may speed up some things since you can start consuming the list before all the computatinos are done.</p>Audrey Tang commented on 'More SMP parallelism.'tag:typepad.com,2003:6a00d83451e8fb69e200d834f3c99569e22006-10-22T15:27:25Z2007-08-18T21:24:52ZAudrey Tanghttp://pugs.blogs.com/Julian: Just spent smoe time trying it (newEmptyTMVarIO, putTMVar, takeTMVar), but it's 5% slower...<p>Julian: Just spent smoe time trying it (newEmptyTMVarIO, putTMVar, takeTMVar), but it's 5% slower...</p>Julian Morrison commented on 'More SMP parallelism.'tag:typepad.com,2003:6a00d83451e8fb69e200d834be613a53ef2006-10-22T12:21:55Z2007-08-18T20:46:34ZJulian MorrisonHave you tried doing that with TMVars, for locklessness?<p>Have you tried doing that with TMVars, for locklessness?</p>