[Haskell-cafe] Concurrency performance problem

Don Stewart dons00 at gmail.com
Mon Mar 4 20:30:35 CET 2013


Apologies, didn't see the link on my phone :)

As the comment on the link shows, youre accidentally migrating unevaluated
work to the main thread, hence no speedup.

Be very careful with evaluation strategies (esp. lazy expressions) around
MVar and TVar points. Its too easy to put a thunk in one.

The strict-concurrency package is one attempt to invert the conventional
lazy box, to better match thge most common case.
On Mar 4, 2013 7:25 PM, "Łukasz Dąbek" <sznurek at gmail.com> wrote:

> What do you exactly mean? I have included link to full source listing:
> http://hpaste.org/83460.
>
> --
> Łukasz Dąbek
>
> 2013/3/4 Don Stewart <dons00 at gmail.com>:
> > Depends on your code...
> >
> > On Mar 4, 2013 6:10 PM, "Łukasz Dąbek" <sznurek at gmail.com> wrote:
> >>
> >> Hello Cafe!
> >>
> >> I have a problem with following code: http://hpaste.org/83460. It is a
> >> simple Monte Carlo integration. The problem is that when I run my
> >> program with +RTS -N1 I get:
> >> Multi
> >> 693204.039020917 8.620632s
> >> Single
> >> 693204.039020917 8.574839s
> >> End
> >>
> >> And with +RTS -N4 (I have four CPU cores):
> >> Multi
> >> 693204.0390209169 11.877143s
> >> Single
> >> 693204.039020917 11.399888s
> >> End
> >>
> >> I have two questions:
> >>  1) Why performance decreases when I add more cores for my program?
> >>  2) Why performance of single threaded integration also changes with
> >> number of cores?
> >>
> >> Thanks for all answers,
> >> Łukasz Dąbek.
> >>
> >> _______________________________________________
> >> Haskell-Cafe mailing list
> >> Haskell-Cafe at haskell.org
> >> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130304/3c4aad6c/attachment.htm>


More information about the Haskell-Cafe mailing list