Gregory Stark <[EMAIL PROTECTED]> writes: > Why do we have this hash function anyways? Is hashany faster than a decent > crc32 implementation?
Yes, significantly. Times to hash 32K bytes 100000 times on a Xeon EM64T: hash_crc(32K): 11.388755 s hash_any_old(32K): 4.401945 s hash_any(32K): 3.862427 s hash_crc is our src/include/utils/pg_crc.h code, hash_any_old is current CVS HEAD, hash_any is the word-wide version. For just 8 bytes (100M repetitions) hash_crc(8 bytes): 2.587647 s hash_any_old(8 bytes): 1.581826 s hash_any(8 bytes): 1.294480 s so in both setup and per-byte terms CRC is more expensive. But the bigger problem is that CRC isn't necessarily designed to have the properties we need, in particular that all bits of the hash are about equally random. It's designed to attack other problems. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers