caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Alain Frisch <alain@frisch.fr>
To: Jon Harrop <jon@ffconsultancy.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Canonical Set/Map datastructure?
Date: Wed, 05 Mar 2008 22:56:54 +0100	[thread overview]
Message-ID: <47CF1726.4090507@frisch.fr> (raw)
In-Reply-To: <200803052003.46517.jon@ffconsultancy.com>

Jon Harrop wrote:
> On Wednesday 05 March 2008 17:27:38 Alain Frisch wrote:
>> Patricia trees work fine when the set elements can easily be represented
>> as strings of bits.
>> ...
>>   structural equality = physical equality = set equality
> 
> This is very interesting. What are the disadvantages? I'm guessing: slow value 
> creation for small values and heavy memory consumption.

I haven't done any serious benchmark comparing Patricia trees and 
OCaml's Set module. For the situations where we're using hash-consed 
Patricia trees, it is simply not an option to use balanced trees (that 
would turn almost linear algorithms into quadratic-or-more ones).

Of course, hash-consing (and memoization of set operations) means extra 
tables and lookups, so there will be some overhead. Last time I checked, 
it was much more efficient to use regular hash tables rather than weak 
ones, but this might have changed since then.

Another disadvantage is that hash-consing usually does not play well 
with marshaling (e.g. you need to manually traverse unmarshaled values 
to restore invariants).

Alain


  reply	other threads:[~2008-03-05 22:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-05 16:49 Berke Durak
2008-03-05 17:16 ` [Caml-list] " Brian Hurt
2008-03-05 17:27 ` Alain Frisch
2008-03-05 19:53   ` Jean-Christophe Filliâtre
2008-03-05 20:03   ` Jon Harrop
2008-03-05 21:56     ` Alain Frisch [this message]
2008-03-06  7:45     ` Jean-Christophe Filliâtre
2008-03-05 17:34 ` Harrison, John R
2008-03-06  9:53 ` Berke Durak
2008-03-06 17:36   ` Harrison, John R
2008-03-07 10:09     ` Berke Durak
2008-03-07 17:13       ` Harrison, John R
2008-03-07 10:19   ` Alain Frisch

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=47CF1726.4090507@frisch.fr \
    --to=alain@frisch.fr \
    --cc=caml-list@yquem.inria.fr \
    --cc=jon@ffconsultancy.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).