Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2000:
[Freeciv-Dev] patch: hash table improvements
Home

[Freeciv-Dev] patch: hash table improvements

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] patch: hash table improvements
From: Jed Davis <jldavis@xxxxxxxxxxxxxx>
Date: Sat, 29 Jul 2000 00:04:30 -0400

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

Attachment: hash.diff
Description: Text document


[Prev in Thread] Current Thread [Next in Thread]