From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: Marco Maggesi <maggesi@math.unifi.it>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] mark_slice, sweep_slice, oldify
Date: Tue, 18 Sep 2001 16:22:30 +0200 [thread overview]
Message-ID: <20010918162230.H23689@pauillac.inria.fr> (raw)
In-Reply-To: <877kv04y6e.fsf@sisiphos.math.unifi.it>; from maggesi@math.unifi.it on Sat, Sep 15, 2001 at 11:10:17AM +0200
> With the aid of gprof I noticed that my program spends most of the time
> of the computation in three functions `mark_slice', `sweep_slice' and
> `oldify' (see below the output of gprof obtained after the computation
> of some products of polynomials).
>
> What does this exactly mean? This is the generational garbage
> collector, right?
Yes. "oldify" is the minor copying collector, and "mark_slice" and
"sweep_slice" are the incremental mark-and-sweep major collector.
> May I low the cost of GC?
There is no general answer to this question. As a rule of thumb,
allocating small, short-lived blocks (that die before the next minor
collection) is very cheap; longer-lived objects cost significantly more.
You could try to play with the GC settings (either at start-up via the
CAMLRUNPARAM environment variable, or programmatically via the Gc.get
and Gc.set functions). E.g. if many of your blocks survive a minor
collection but die shortly thereafter, increasing the size of the
minor heap could help. If your program runs for a short amount of
time, you could try increasing the "overhead" parameter to, say, 100,
to make the incremental major collector work less.
The GC statistics returned by Gc.stat could also be of interest,
although you need a bit of background in garbage collection to
understand what they really mean :-)
Sometimes, the program can be rewritten to eliminate allocation of
intermediate data structures. This is known as "deforestation" in the
literature. For a simple-minded example: if you often sum three
polynomials, instead of writing "poly_add x (poly_add y z)"
(which causes the intermediate polynomial y + z to be allocated),
write a "poly_add3" function that will sum three polynomials in one go.
Good luck,
- Xavier Leroy
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
next prev parent reply other threads:[~2001-09-18 14:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-09-15 9:10 Marco Maggesi
2001-09-18 14:22 ` Xavier Leroy [this message]
2001-09-19 16:40 Damien Doligez
2001-09-19 19:06 ` Chris Hecker
2001-09-22 18:15 ` John Max Skaller
2001-09-22 18:24 ` John Max Skaller
2001-09-24 17:48 ` Marco Maggesi
2001-09-27 16:59 ` Thorsten Ohl
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=20010918162230.H23689@pauillac.inria.fr \
--to=xavier.leroy@inria.fr \
--cc=caml-list@inria.fr \
--cc=maggesi@math.unifi.it \
/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