From: "Armaël Guéneau" <armael.gueneau@ens-lyon.fr>
To: caml-list@inria.fr
Cc: "Arthur Charguéraud" <arthur@chargueraud.org>
Subject: [Caml-list] Hashtbl and shrinking
Date: Thu, 29 Mar 2018 22:49:20 +0200 [thread overview]
Message-ID: <b779b358-d344-4a4c-c790-746f7e569cf7@ens-lyon.fr> (raw)
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
next reply other threads:[~2018-03-29 20:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-29 20:49 Armaël Guéneau [this message]
2018-03-30 9:40 ` Christoph Bauer
2018-03-30 19:10 ` Cedric Cellier
2018-04-02 0:34 ` Francois BERENGER
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=b779b358-d344-4a4c-c790-746f7e569cf7@ens-lyon.fr \
--to=armael.gueneau@ens-lyon.fr \
--cc=arthur@chargueraud.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