caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Hashtbl and shrinking
@ 2018-03-29 20:49 Armaël Guéneau
  2018-03-30  9:40 ` Christoph Bauer
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Armaël Guéneau @ 2018-03-29 20:49 UTC (permalink / raw)
  To: caml-list; +Cc: Arthur Charguéraud

Dear caml-list,

It happens Arthur Charguéraud and myself were looking this afternoon at
the implementation of the Hashtbl module, provided in our beloved OCaml
standard library.

We noticed there is no shrinking implemented, that would typically
happen when the number of elements goes under a certain threshold
compared to the size of the underlying array.

This yields a space complexity that we think may not be what people
might expect: an almost empty hashtable will consume as much memory as
when it was full. The time complexity might also be worse than expected,
because the GC will still spend time scanning the whole array even when
there are only a few elements.

What do people here think about this?
If we submitted a patch implementing shrinking for Hashtbl, could it be
detrimental for some specific workloads?

— Armaël

-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

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

end of thread, other threads:[~2018-04-02  0:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-29 20:49 [Caml-list] Hashtbl and shrinking Armaël Guéneau
2018-03-30  9:40 ` Christoph Bauer
2018-03-30 19:10 ` Cedric Cellier
2018-04-02  0:34 ` Francois BERENGER

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