Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* [Caml-list] Hashtbl or Set?
@ 2011-09-19 20:09 Ian Zimmerman
  2011-09-19 20:17 ` Basile Starynkevitch
  2011-09-20 10:13 ` Gerd Stolpmann
  0 siblings, 2 replies; 3+ messages in thread
From: Ian Zimmerman @ 2011-09-19 20:09 UTC (permalink / raw)
  To: caml-list


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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-09-20 10:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-19 20:09 [Caml-list] Hashtbl or Set? Ian Zimmerman
2011-09-19 20:17 ` Basile Starynkevitch
2011-09-20 10:13 ` Gerd Stolpmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox