This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: hash?
Greg Harvey <Greg.Harvey@thezone.net> writes:
> It doesn't necessarily have to (that being the nature of hashes and
> all); the code for strhash when strings are > 5 characters long only
> uses five characters of the string to determine the hash; in this
> case, the particular selection of hash size, strings, and string
> lengths have given us the dreaded `worst case scenario'.
I think the Right Thing to do here (both speedy and reasonably
diffused) would be to step through string with step equal lenth >> 2.
This would still use only 4 chars but once the string length is 8 or
more, it would at least use reasonable snapshot of the string.
> Looking at the code I'm curious about the selection of initial hash as
> 264 % table size; I'd think it'd be better to make the generated hash
> totally dependant on the value being hashed, rather than a fixed start
> value for each hash for a particular size table (264 might not be the
> best value to go there, either, but it's been a while since I've
> looked deeply at hashes, so I might just be being prime-centric).
True - making hash independant on the table size would also allow
storing the full (nondivided) hashes into the table for dynamic
resize/rehash.
--
How to eff the ineffable?