|
LS.
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? best, Jur _______________________________________________ Glasgow-haskell-users mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users |
|
I would also be interested to know this. A web server is an example of
a Haskell program that could force garbage collection at the end of every request reply, especially a multi-threaded server where the memory use is localized to threads. For long-running applications, a GC at this point would be nice. _______________________________________________ Glasgow-haskell-users mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users |
|
In reply to this post by Jurriaan Hage
Hi,
Am Montag, den 07.05.2012, 15:33 +0200 schrieb Jurriaan Hage: > 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? there is performGC: http://hackage.haskell.org/packages/archive/base/latest/doc/html/System-Mem.html#v:performGC Greetings, Joachim -- Joachim "nomeata" Breitner [hidden email] | [hidden email] | GPG: 0x4743206C xmpp: [hidden email] | http://www.joachim-breitner.de/ _______________________________________________ Glasgow-haskell-users mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users |
|
In reply to this post by Jurriaan Hage
Hi,
On Mon, May 7, 2012 at 6:33 AM, Jurriaan Hage <[hidden email]> wrote: > LS. > > 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. -- Johan _______________________________________________ Glasgow-haskell-users mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users |
|
In reply to this post by Christopher Done
On Mon, May 7, 2012 at 7:00 AM, Christopher Done
<[hidden email]> wrote: > I would also be interested to know this. A web server is an example of > a Haskell program that could force garbage collection at the end of > every request reply, especially a multi-threaded server where the > memory use is localized to threads. For long-running applications, a > GC at this point would be nice. In non-GCed language people often use an arena allocator in situations like this. However, a semi-space collector (which is what we use) we get that behavior for free. If your request is processed in less time than the minor GC cycle, all your data will be dead by the time the GC run and thus collecting it is free. -- Johan _______________________________________________ Glasgow-haskell-users mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users |
|
In reply to this post by Jurriaan Hage
On 07/05/2012 14:33, Jurriaan Hage wrote:
> LS. > > 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? It is more likely that you are trading extra memory for better performance, rather than triggering the GC at a good time. GC is basically a space/time tradeoff, see: http://stackoverflow.com/questions/3171922/ghcs-rts-options-for-garbage-collection/3172704#3172704 If you think the program has points where residency is very low and it would be good to trigger a GC, I would first confirm the hypothesis by doing a heap profile. GC can be triggered with System.Mem.performGC. Cheers, Simon _______________________________________________ Glasgow-haskell-users mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users |
| Powered by Nabble | Edit this page |
