Re: machine-dependent hash_any vs the regression tests

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: machine-dependent hash_any vs the regression tests
Дата
Msg-id 11205.1207435448@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: machine-dependent hash_any vs the regression tests  (Gregory Stark <stark@enterprisedb.com>)
Список pgsql-hackers
Gregory Stark <stark@enterprisedb.com> 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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Gregory Stark
Дата:
Сообщение: Re: machine-dependent hash_any vs the regression tests
Следующее
От: Hannu Krosing
Дата:
Сообщение: Adding pipelining support to set returning functions