hash algorithm
Henry Spencer
henry at utzoo.uucp
Thu Aug 25 02:14:22 AEST 1988
In article <2392 at rtech.rtech.com> daveb at llama.UUCP (Dave Brower) writes:
>If the collision chains generated by the naive function are short, it
>may be cheaper to search the chain than use a smarter hash.
>
>What I found in some real application, with about 3000 entries in the
>table, was that naive beat smart in real execution time. The naive
>collision chains were typically 4-7 entries long. I could not reduce
>the time spent in the smart hash function enough to make it worth using.
I second this. Those of you who have looked over that masterpiece of
brilliant coding :-), the C News expire, will have noticed that it hashes
newsgroups simply by the length of the name. Crude and inelegant... but
the longest collision chain is only a handful of entries long, and none
of the fancier hash functions did significantly better.
--
Intel CPUs are not defective, | Henry Spencer at U of Toronto Zoology
they just act that way. | uunet!attcan!utzoo!henry henry at zoo.toronto.edu
More information about the Comp.lang.c
mailing list