[Haskell-cafe] Multi threaded garbage collector
Andrew Coppin
andrewcoppin at btinternet.com
Sun May 18 09:46:06 EDT 2008
Peter Verswyvelen wrote:
> Hi all,
>
> I did some experiments with concurrent Haskell, and unfortunately I
> couldn't get my code run faster when using more cores, actually it ran
> a bit slower.
>
> Now I noticed after profiling that about 70% of the time my program
> was performing garbage collection (I had lists of 50000 tiny objects
> that got recreated 100 times per second).
>
> If I understood it correctly, the current garbage collector of GHC is
> single threaded, which really hinders SMP
>
> Any plans on improving this or workarounds?
Parallel or not, if you can figure out a way to make your program
require less GC work, it will go faster.
The current GC requires all Haskell threads to be halted while it does
its work. I understand there is a new GC under development that uses
multiple cores [i.e., a GC pass now takes less time]. However, it still
required all Haskell threads to be halted while it runs. (It's just that
it takes less time to run now.)
Either way, if you can somehow figure out how to do less GC, you'll win.
Notice that sometimes just doing work in a different order can
significantly reduce GC load.
More information about the Haskell-Cafe
mailing list