From: Pierre Weis <weis@pauillac.inria.fr>
To: caml-list@pauillac.inria.fr
Subject: Sharing
Date: Wed, 16 Mar 1994 20:43:15 +0100 (MET) [thread overview]
Message-ID: <9403161943.AA15660@pauillac.inria.fr> (raw)
Hi John,
As far as I know nobody have ever tried to implement global hash
consing in CAML. However structure-sharing on terms handled by the coq
system have been used once. It revealed to be interesting but not
decisive for efficiency.
On the other hand, there exists at least one implementation of ML
featuring hash-consing: HiML written by Jean Goubault
(J.Goubault@frcl.bull.fr). He showed that this can be feasible and efficient.
If you don't want to share everything ever allocated in the memory but
some well identified objects, you can perfectly use hash tables. The
problem is, as you mentioned it, that objects you put in a global hash
table cannot be reclaimed by the garbbage collector, since they are in
used (in the hash table!). This is not a problem, if you already know
that these object are structures or parts of structures already used
elsewhere. That's why sharing was used in coq for theories, that were
necessarily manipulated by the theorem prover.
Finally, the hash tables in the "hashtbl" module are not magic: they
are written in Caml, and you can read the source code which is in the
standard distribution. We do not claim that these hash tables got
the most efficient implementation: their implementation is reasonably
good and works very fine in most cases. But since you have the source
code, you can adapt this code to your particular problem, it a very
common practice to redefine some of the library functions to tune it
to a particular use.
Pierre Weis
reply other threads:[~1994-03-16 19:56 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=9403161943.AA15660@pauillac.inria.fr \
--to=weis@pauillac.inria.fr \
--cc=caml-list@pauillac.inria.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