Re: New CRC algorithm: Slicing by 8

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: New CRC algorithm: Slicing by 8
Дата
Msg-id 27524.1161631269@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: New CRC algorithm: Slicing by 8  (Jeremy Drake <pgsql@jdrake.com>)
Ответы Re: New CRC algorithm: Slicing by 8  (Jeremy Drake <pgsql@jdrake.com>)
Список pgsql-hackers
Jeremy Drake <pgsql@jdrake.com> writes:
> On Mon, 23 Oct 2006, Tom Lane wrote:
>> That's not a good workaround, because making mycrc expensive to access
>> means your inner loop timing isn't credible at all.  Instead try making the
>> buffer array nonlocal --- malloc it, perhaps.

> That did not make any difference.  The way I see it, the only way to
> convince the compiler it really needs to do this loop more than once is to
> make it think it is not overwriting the same variable every time.  The
> subscript was the cheapest way I could think of to do that.  Any other
> suggestions on how to do this are welcome.

Hmm.  Maybe store the CRCs into a global array somewhere?
uint32 results[NTESTS];
for ...{    INIT/COMP/FIN_CRC32...    results[j] = mycrc;}

This still adds a bit of overhead to the outer loop, but not much.

Another possibility is to put the INIT/COMP/FIN_CRC32 into an external
subroutine, thereby adding a call/return to the outer loop overhead.
        regards, tom lane


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

Предыдущее
От: Jeremy Drake
Дата:
Сообщение: Re: New CRC algorithm: Slicing by 8
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Tsearch2 index size