[Freeciv-Dev] patch: hash table improvements
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Well, I hope they're improvements, anyway:
* Replaced hash_fval_int and hash_fval_string. hash_fval_int had a bit of
a bug: if it's given a series of numbers that differ by a multiple of the
table size (including any larger power of 2), they'll all hash to the same
bucket. hash_fval_string might have done something similar.
* Added hash_f{val,cmp}_keyval, which hashes the key pointer values instead
of something referenced by them, so void* or long values can be used as
keys.
* Tables now resize when the fraction of used buckets goes below a certain
point. Also tables expand a little more conservatively and are more likely
than before to rehash with the same size or shrink. There probably isn't
any noticeable effect, either positive or negative, on CPU or memory usage.
& Hash table sizes are still as general as they were before; i.e., not
restricted to powers of 2, like I'd threatened (-: before.
--Jed, hoping this attachment works
hash.diff
Description: Text document
- [Freeciv-Dev] patch: hash table improvements,
Jed Davis <=
|
|