caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Alain Frisch <alain.frisch@lexifi.com>
To: "François Bobot" <francois.bobot@cea.fr>, caml-list@inria.fr
Subject: Re: [Caml-list] Presumed bug in OCaml's garbage collector or in its Weak module...
Date: Tue, 21 Jun 2016 21:37:24 +0200	[thread overview]
Message-ID: <8718df5d-2129-2404-ab56-188331d15a6d@lexifi.com> (raw)
In-Reply-To: <0d64f186-6518-dea7-9082-4c06802449f7@cea.fr>

On 21/06/2016 14:43, François Bobot wrote:
> However it would be interesting to keep the nice property that
> `get_copy` give us for the implementation of weak structure, without
> using unsafe features. The nice property is that a value is not kept
> alive just because it collides with a value that is often accessed.
> Perhaps a kind of transient roots, which are considered as root only at
> the end of the each part of mark phase, would allow to mark the value as
> few time as possible. But the API would not be pretty...

Not directly related to this thread, but it might be worth mentioning 
that for our use case (hash-consing terms), disabling the shallow copy 
(i.e. using get instead of get_copy) lead to very significant 
performance gains.  The main explanation is probably that it reduces 
quite a bit the pressure on the GC (more than the avoided cost of the 
copy itself, I guess).  Another possible explanation is that keeping 
some values a bit longer in the weak set is actually a good thing in our 
usage scenario (we keep some derived values, computed only when the term 
is first inserted in the weak set); this is also exacerbated by the 
lower rate of the GC (the first explanation).  We are "saved" by the 
fact that phases that exercises the weak set a lot are alternating with 
other GC-intensive phases (which guarantee that the weak set are 
eventually pruned).

Perhaps the "official" Weak.Make should at least allow to use get 
instead of get_copy?


Alain

  reply	other threads:[~2016-06-21 19:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-17 18:09 "Martin R. Neuhäußer"
2016-06-17 19:23 ` Gabriel Scherer
2016-06-18 15:15   ` "Martin R. Neuhäußer"
2016-06-17 19:41 ` Török Edwin
2016-06-17 20:29   ` "Martin R. Neuhäußer"
2016-06-18 10:59     ` Josh Berdine
2016-06-18 15:11   ` "Martin R. Neuhäußer"
2016-06-18 16:54   ` Leo White
2016-06-21 12:43     ` François Bobot
2016-06-21 19:37       ` Alain Frisch [this message]
2016-06-22  8:12         ` François Bobot
2016-06-18 17:39 ` "Martin R. Neuhäußer"
2016-06-21 11:55   ` François Bobot
2016-06-27 11:35     ` AW: " Neuhaeusser, Martin

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=8718df5d-2129-2404-ab56-188331d15a6d@lexifi.com \
    --to=alain.frisch@lexifi.com \
    --cc=caml-list@inria.fr \
    --cc=francois.bobot@cea.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;
as well as URLs for NNTP newsgroup(s).