From: Aaron Bohannon <bohannon@seas.upenn.edu>
To: Damien Doligez <damien.doligez@inria.fr>
Cc: OCaml List <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] Gc.compact surprisingly helpful
Date: Mon, 7 Dec 2009 22:30:50 -0500 [thread overview]
Message-ID: <c413fcb70912071930sb93aa57yeb51fd3efd6a3bac@mail.gmail.com> (raw)
In-Reply-To: <95594484-7A9F-4ECA-B7A8-079D433BF4FB@inria.fr>
On Sat, Dec 5, 2009 at 12:06 PM, Damien Doligez <damien.doligez@inria.fr> wrote:
>
> On 2009-12-04, at 20:09, Aaron Bohannon wrote:
>
>> So in a 15 second run (with no
>> idle time, as I said), it now does about 130 heap compactions instead
>> of 3 and gets better total performance because of it, utterly defying
>> my GC intuition.
>
> What is the size of your heap? Have you tried compacting only once
> every 2, 3, 5, or 10 loops?
In a 15 sec run, the total allocated memory is about 8GB (from
Gc.allocated_bytes()). The max heap size reached using one compaction
per loop is about 7MB (on a 64-bit machine, based on the
"top_heap_words" field). The max heap size reached with no
compactions at all is only about 10MB. These numbers may seem wierd,
but they are really not too surprising since the program is a
signal-processing pipeline that does a huge number of (purely
functional) Array.map and Array.init operations to build short-lived
intermediate results, and it does the same operatations in each
(sub-)cycle regardless of the input.
Yeah, I can squeeze out a bit more performance by using calling
Gc.compact slightly less often, as suggested, but since we're only
talking about around 5%, it doesn't make much difference. In theory,
I could also optimize away some allocation by replacing functional
Array ops with imperative Array updates, but the throughput seems good
enough right now---I'm actually just concerned about how to keep the
the maximum GC pause time as low as possible.
- Aaron
next prev parent reply other threads:[~2009-12-08 8:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-04 19:09 Aaron Bohannon
2009-12-04 19:31 ` [Caml-list] " Florian Hars
2009-12-05 17:06 ` Damien Doligez
2009-12-08 3:30 ` Aaron Bohannon [this message]
2009-12-05 17:35 ` Xavier Leroy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c413fcb70912071930sb93aa57yeb51fd3efd6a3bac@mail.gmail.com \
--to=bohannon@seas.upenn.edu \
--cc=caml-list@yquem.inria.fr \
--cc=damien.doligez@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox