caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] why does hashtbl not use lists?
@ 2001-07-10  8:34 Chris Hecker
  2001-07-10  9:00 ` Fergus Henderson
  2001-07-10  9:05 ` Jean-Christophe Filliatre
  0 siblings, 2 replies; 6+ messages in thread
From: Chris Hecker @ 2001-07-10  8:34 UTC (permalink / raw)
  To: caml-list


Why does hashtbl.ml (from the standard library) use the bucketlist variant instead of just the built in lists with tuples?  Is there an efficiency thing going on here?

type ('a, 'b) t =
  { mutable max_len: int;                     (* max length of a bucket *)
    mutable data: ('a, 'b) bucketlist array } (* the buckets *)
and ('a, 'b) bucketlist =
    Empty
  | Cons of 'a * 'b * ('a, 'b) bucketlist

instead of 

type ('a, 'b) t =
  { mutable max_len: int;                     (* max length of a bucket *)
    mutable data: ('a * 'b) list array }      (* the buckets *)

Chris

-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: [Caml-list] why does hashtbl not use lists?
@ 2001-07-10 17:04 Charles Martin
  0 siblings, 0 replies; 6+ messages in thread
From: Charles Martin @ 2001-07-10 17:04 UTC (permalink / raw)
  To: caml-list

At 07:42 PM 7/10/01 +1000, Fergus Henderson wrote:
>If you have a compacting garbage collector, as I'm pretty sure Ocaml does,
>and a good compiler, then the compiler would be able to combine the two
>allocations into a single one.  Does Ocamlopt do that?

In my experience, yes, every time: asmcomp/comballoc.ml



__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


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

end of thread, other threads:[~2001-07-11 15:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-10  8:34 [Caml-list] why does hashtbl not use lists? Chris Hecker
2001-07-10  9:00 ` Fergus Henderson
2001-07-10  9:05 ` Jean-Christophe Filliatre
2001-07-10  9:42   ` Fergus Henderson
2001-07-10 14:44     ` Xavier Leroy
2001-07-10 17:04 Charles Martin

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).