Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Ian Zimmerman <itz@buug.org>
To: caml-list@inria.fr
Subject: [Caml-list] Hashtbl or Set?
Date: Mon, 19 Sep 2011 13:09:39 -0700	[thread overview]
Message-ID: <87sjnsl2f0.fsf@foolinux.dyndns.org> (raw)


I need a somewhat large (thousands) set of strings, created once during
startup and never modified after.  What is a better choice, a (string,
unit) Hashtbl.t or the Set module?  If the Set module still uses trees
as it did when I was young :-), access will be logarithmic versus
constant for Hashtbl.  But on the other hand a hash function must
examine all of every string while the comparison of 2 strings stops at
the first nonmatching character.

I am thinking about the time to build the set as well as the probing
time.

-- 
Ian Zimmerman
gpg public key: 1024D/C6FF61AD
fingerprint: 66DC D68F 5C1B 4D71 2EE5  BD03 8A00 786C C6FF 61AD
Rule 420: All persons more than eight miles high to leave the court.

             reply	other threads:[~2011-09-19 20:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-19 20:09 Ian Zimmerman [this message]
2011-09-19 20:17 ` Basile Starynkevitch
2011-09-20 10:13 ` Gerd Stolpmann

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=87sjnsl2f0.fsf@foolinux.dyndns.org \
    --to=itz@buug.org \
    --cc=caml-list@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