Explicit calls to the garbage collector.
johan.tibell at gmail.com
Mon May 7 19:26:47 CEST 2012
On Mon, May 7, 2012 at 6:33 AM, Jurriaan Hage <J.Hage at uu.nl> wrote:
> I have a very memory intensive application. It seems that the timing of my application
> depend very much on the precise setting of -H...M in the runtime system (-H2000M
> seems to work best, computation time becomes a third of what I get when I pass no
> -H option). I conjecture that this good behaviour is the result of gc happening at the right time.
> So I wondered: if I can one when is the right time, is it possible then to trigger
> GC explicitly from within the Haskell code?
You have to be very careful when benchmarking programs in garbage
collected languages. If you set the nursery size high enough the GC
might never run during your benchmark, but in a real program a big
nursery might perform worse than a smaller one. For any small GC bound
benchmark you can typically get it to run much faster by setting -A to
some ridiculous high number.
More information about the Glasgow-haskell-users