caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Goswin von Brederlow <goswin-v-b@web.de>
To: Jianzhou Zhao <jianzhou@seas.upenn.edu>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Average cost of the OCaml GC
Date: Thu, 11 Nov 2010 10:08:08 +0100	[thread overview]
Message-ID: <87bp5w1b47.fsf@frosties.localnet> (raw)
In-Reply-To: <AANLkTinaSS+QOCJ8AA9LMMM9OHZMKZ2NVQr9KY48XkK_@mail.gmail.com> (Jianzhou Zhao's message of "Wed, 10 Nov 2010 22:59:55 -0500")

Jianzhou Zhao <jianzhou@seas.upenn.edu> writes:

> Hi,
>
> What is the average cost of the OCaml GC? I have a program that calls
> 'mark_slice' in 57% of the total execution time, and calls
> 'sweep_slice' in 21% of the total time, reported by Callgrind, which
> is a profiling tool in Valgrind. 57% and 21% are the 'self cost' ---
> the cost of the function itself ('Self Cost'), rather than the cost
> including all called functions ('Inclusive Cost'). I guess
> 'mark_slice'  and  'sweep_slice'  are functions from OCaml GC. Are
> these numbers normal?

Those numbers sound rather high to me.

> My program calls both OCaml and C, which passes around C data types in
> between. I also doubt if I defined the interface in an 'unefficient'
> way that slows down the GC. Are there any rules in mind to make GC
> work more efficiently?

You can tune some of the GC parameters to suit your use case.

Do you allocate custom types from C? In caml_alloc_custom(ops, size,
used, max) the used and max do influence the GC how often to run. If
you set them wrong you might trigger the GC too often.

MfG
        Goswin


  reply	other threads:[~2010-11-11  9:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-11  3:59 Jianzhou Zhao
2010-11-11  9:08 ` Goswin von Brederlow [this message]
2010-11-11 13:52   ` [Caml-list] " Jianzhou Zhao
2010-11-11 14:14     ` Michael Ekstrand
2010-11-11 20:11     ` Goswin von Brederlow
2010-11-12 17:27       ` Jianzhou Zhao
2010-11-12 21:54         ` ygrek
2010-11-16 10:02         ` Goswin von Brederlow

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=87bp5w1b47.fsf@frosties.localnet \
    --to=goswin-v-b@web.de \
    --cc=caml-list@yquem.inria.fr \
    --cc=jianzhou@seas.upenn.edu \
    /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;
as well as URLs for NNTP newsgroup(s).