From: Chet Murthy <chet@watson.ibm.com>
To: "Jörgen Gustavsson" <gustavss@cs.chalmers.se>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Memory management dominates running time
Date: Sun, 05 Jan 2003 06:35:17 -0500 [thread overview]
Message-ID: <200301051135.h05BZHiY009447@nautilus-chet.watson.ibm.com> (raw)
In-Reply-To: Your message of "Fri, 03 Jan 2003 22:58:34 +0100." <Pine.SOL.4.30.0301032109550.17168-100000@muppet20.cs.chalmers.se>
By using gprof, and doing a little careful counting, you can
often find out where egregious allocations are happening, and
eliminate them.
I can't give you good pointers on this, because, well, it's a bit of
an art, and takes a lot of experience. But it _is_ doable, and I have
done it to nontrivial programs in Caml, as well as in Java, attaining
speedups of 2x, 3x, without much code-restructuring.
E.g., once, I took a Stream-based parser, and wrote a Stream module
which only supported "char Stream", and only for parsing.
By writing a few auxiliary functions in addition to this, I was able
to reduce the consing associated with stream-based parsing (the
constant creation of "Some _" blocks) significantly, and got a rather
large speedup.
I was able to see that this was important, basically by looking around
in the gprof profile and trying to follow where the allocation were
happening.
--chet--
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
next prev parent reply other threads:[~2003-01-08 1:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-03 21:58 Jörgen Gustavsson
2003-01-04 1:20 ` Norman Ramsey
2003-01-05 11:35 ` Chet Murthy [this message]
2003-01-08 12:58 ` Jörgen Gustavsson
2003-01-08 14:20 ` Damien Doligez
2003-01-08 22:23 ` [Caml-list] GlSurf 1.2 available Christophe Raffalli
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=200301051135.h05BZHiY009447@nautilus-chet.watson.ibm.com \
--to=chet@watson.ibm.com \
--cc=caml-list@inria.fr \
--cc=gustavss@cs.chalmers.se \
/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