Re: use CLZ instruction in AllocSetFreeIndex()

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: use CLZ instruction in AllocSetFreeIndex()
Дата
Msg-id 6478.1577462722@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: use CLZ instruction in AllocSetFreeIndex()  (John Naylor <john.naylor@2ndquadrant.com>)
Ответы Re: use CLZ instruction in AllocSetFreeIndex()  (John Naylor <john.naylor@2ndquadrant.com>)
Список pgsql-hackers
John Naylor <john.naylor@2ndquadrant.com> writes:
> On Fri, Dec 27, 2019 at 9:54 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> ... but couldn't the
>> right shift be elided in favor of changing the constant we
>> subtract clz's result from?  Shifting off those bits separately
>> made sense in the old implementation, but assuming that CLZ is
>> more or less constant-time, it doesn't with CLZ.

> That makes sense -- I'll look into doing that.

Actually, we could apply that insight to both code paths.
In the existing path, that requires assuming 
ALLOCSET_NUM_FREELISTS+ALLOC_MINBITS <= 17, but that's OK.
(Nowadays I'd probably add a StaticAssert about that.)

            regards, tom lane



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

Предыдущее
От: John Naylor
Дата:
Сообщение: Re: use CLZ instruction in AllocSetFreeIndex()
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Remove libpq.rc, use win32ver.rc for libpq