Martin Stjernholm, Roxen IS @ Pike developers forum wrote:
Pointers are worse. They can contain all sorts of periodicity. An
it's different for each and every one of them). A prime modulo is very effective to put all such concerns to rest. Maybe there are other
Is Pike doing a lot of pointer hashing?
Well, for everything except integers, floats and objects with lfun::__hash() (ie most objects, strings, programs, etc) used as index in a mapping (cf svalue.c:hash_svalue())...
Incidentally, using a prime module to hash a pointer sounds fine to me, it just means that the modulo is part of the hash function. The only
Multiplying with a suitable prime and then shifting and masking would most likely be of similar strength, but be much cheaper cpu-wise.
thing I find "bad design" is if the hash-table lookup forces a prime modulo, even if a good hash function has already been used. We should focus on improving the hash functions in general.
Agreed.