This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: hash table subtleties






>I'd like to also repeat what I mentioned elsewhere - namely if you
>shrink the tables on deletions you can easily get the bad behavior of
>resizing every few operations (on a mix of insertions & deletions)
>causing the hash tables to give O(n) behavior instead of O(1).
>They'll be slower than an alist, let alone a balanced tree.

That doesn't mean you shouldn't shrink tables. It just means you should be
smart about it - have a high water mark and a low water mark. It's a bit
like the thermostat problem. You don't want the heater switching on and
off every two seconds when the temperature reaches equilibrium.