From: Jon Harrop <jon@ffconsultancy.com>
To: caml users <caml-list@inria.fr>
Subject: Profiling garbage
Date: Wed, 14 Sep 2005 03:21:42 +0100 [thread overview]
Message-ID: <200509140321.43045.jon@ffconsultancy.com> (raw)
I've recently been trying to optimise Presenta. The profiling results
surprised me. Most of the time was spent in the GC, invoked by
"<spontaneous>". I assumed this meant that the GC was recycling enormous
amounts of garbage from the old generation. Had it been recycled from the
young generation then I assume the calls to the (minor) GC would be invoked
by the allocating function - is that right?
Anyway, the best way I found to track down the offending function was to write
lots of extra code to spew out Gc.stat results and look at the amount of data
being allocated by each function call. Doing this by hand is very tedious, of
course. So I'm wondering, are there any tools to profile allocation and
collection on a per function basis for OCaml code? I'm thinking of something
along the lines of gprof results but showing space rather than time taken.
I managed to find the offending function by hand this time - it was
retypesetting the entire document every frame, regenerating the scene graph.
Memoizing it improved the performance of the whole program by an order of
magnitude. So this is definitely an optimisation trick worth remembering...
--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
Objective CAML for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists
next reply other threads:[~2005-09-14 2:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-14 2:21 Jon Harrop [this message]
2005-09-14 12:23 ` [Caml-list] " Damien Bobillot
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=200509140321.43045.jon@ffconsultancy.com \
--to=jon@ffconsultancy.com \
--cc=caml-list@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