|Anonymous | Login | Signup for a new account||2014-09-16 09:25 CEST|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0005555||OCaml||OCaml standard library||public||2012-03-26 09:27||2012-06-06 13:35|
|Priority||normal||Severity||minor||Reproducibility||have not tried|
|Target Version||Fixed in Version||4.00.0+dev|
|Summary||0005555: Hashtbl.remove/clear never shrink the internal bucket array|
|Description||The internal bucket array of an hashtable grows in Hashtbl.add/replace,|
but neither Hashtbl.remove nor Hashtbl.clear shrink the table.
|Tags||No tags attached.|
|A new function Hashtbl.reset has been added to resize the bucket table to its initial size.|
|It's not quite resizing. So the user is supposed to track the size of the hash and reset it when judged appropriate ?|
|True, it's not resizing, it is clearing and resetting to the initial size. Users should only use it if they need to recover some space, otherwise, they probably want to keep the current size and just clear all entries.|
Oh, reading your comment then the actual diff I realize that reset also clears the hashtbl.
I then respectfully disagree with closing this ticket, then.
That's very nice to have both clear and reset behavior (but I'd favor to add an optional boolean argument to clear that would additionnally shrinks the hash size).
It seams to me that the initial concern was that when using long lived hashtables which sizes may vary in great proportion then the overall size of all hashtable growth continuously, which hurts memory and thus performances.
I understand that shrinking dynamically a hash is a tedious topic (one must avoid to continuously grow/shrink), though.
Christoph Bauer (reporter)
|I would have expect, that Hashtbl.remove calls resize like add, if the table is less than 3/8 (or 1/4) full.|
|2012-03-26 09:27||Christoph Bauer||New Issue|
|2012-03-26 14:26||lefessan||Assigned To||=> lefessan|
|2012-03-26 14:26||lefessan||Status||new => assigned|
|2012-05-15 11:01||lefessan||Note Added: 0007431|
|2012-05-15 11:01||lefessan||Status||assigned => resolved|
|2012-05-15 11:01||lefessan||Fixed in Version||=> 4.00.0+dev|
|2012-05-15 11:01||lefessan||Resolution||open => fixed|
|2012-05-15 13:03||rixed||Note Added: 0007433|
|2012-05-15 15:58||lefessan||Note Added: 0007434|
|2012-05-15 16:12||rixed||Note Added: 0007436|
|2012-06-06 13:35||Christoph Bauer||Note Added: 0007519|
|Copyright © 2000 - 2011 MantisBT Group|