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] |
> What is the magic constant 264 in `scm_strhash()'? It's a magic constant! To be honest, that is Aubrey's code, and I don't entirely understand its design. It looks as if, if the string being hashed is longer than five characters, the hash function sort of samples five characters at random from the string, and ignores the rest. 264 is just the seed value for the hash accumulator. Hash functions are a weird area, because the requirements on a hash function are pretty open-ended --- the value doesn't have to mean anything --- and the quality of a given hash function depends on the data you apply it to. So their design seems like somewhat of a black art: "season with prime numbers to taste." I can show a graph of how well a bunch of hash functions perform, but it's difficult to say *why* a given function is better...