caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Berke Durak <berke.durak@exalead.com>
To: Xavier Leroy <Xavier.Leroy@inria.fr>
Cc: Markus Mottl <markus.mottl@gmail.com>,
	ocaml-users@janestcapital.com, ocaml <caml-list@inria.fr>
Subject: Re: [Caml-list] Global roots causing performance problems
Date: Fri, 07 Mar 2008 15:52:16 +0100	[thread overview]
Message-ID: <47D156A0.5010701@exalead.com> (raw)
In-Reply-To: <47D14CBD.4060207@inria.fr>

Xavier Leroy a écrit :

Hello,

> This "generational" approach is the natural solution to the problem
> you mention.  However, it is not compatible with the current API for
> global root registration: when a program registers a "value *" pointer
> using caml_register_global_root(), the program is free to change the
> value contained in that placeholder at any time without notifying the
> Caml memory manager.  As a consequence, the minor GC has no choice but
> scanning all global roots every time, because any of them could have
> been overwritten with a freshly-allocated Caml block since the
> previous minor GC.
> 
> There are 2 ways to go about this problem:
> 
> 1- Change the specs of caml_register_global_root() to prohibit
> in-place updates to the value contained in the registered value
> pointer.  If programmers need to do this, they must un-register the
> value pointer, update its contents, then re-register it.
> How much existing code would that break?  I don't know.

I'm using caml_register_global_root extensively in Aurochs when building
the parse tree, and updating it in-place (consing a list of children nodes,
actually.)

If you change the semantics of caml_register_global_root() it would
be nice to have a caml_modify_global_root() macro that does what is
needed.

> 2- Keep the current API for backward compatibility and add a
> caml_register_global_immutable_root() function that would implement
> generational scanning of global roots, in exchange for the
> programmer's guarantee that the values contained in those roots are
> never changed.  Then, convince authors of Caml-C bindings to use the
> new API.

That's the better solution IMHO, as it won't break existing code and gives
a clear migration path to better performance and improved customer satisfaction.

> I'm willing to implement any of these 2 approaches, but it is not a
> transparent change in either case.

-- 
Berke DURAK


  reply	other threads:[~2008-03-07 14:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-06 23:51 Markus Mottl
2008-03-07 14:10 ` [Caml-list] " Xavier Leroy
2008-03-07 14:52   ` Berke Durak [this message]
2008-03-07 16:45   ` Richard Jones
2008-03-07 17:05   ` Markus Mottl

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=47D156A0.5010701@exalead.com \
    --to=berke.durak@exalead.com \
    --cc=Xavier.Leroy@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=markus.mottl@gmail.com \
    --cc=ocaml-users@janestcapital.com \
    /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).