Re: [PATCH v3] Avoid manual shift-and-test logic in AllocSetFreeIndex

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [PATCH v3] Avoid manual shift-and-test logic in AllocSetFreeIndex
Дата
Msg-id 14195.1248053651@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [PATCH v3] Avoid manual shift-and-test logic in AllocSetFreeIndex  (Jeremy Kerr <jk@ozlabs.org>)
Ответы [PATCH v4] Avoid manual shift-and-test logic in AllocSetFreeIndex  (Jeremy Kerr <jk@ozlabs.org>)
Список pgsql-hackers
Jeremy Kerr <jk@ozlabs.org> writes:
>>> - inline is forbidden to use in PostgreSQL - you need exception or
>>> do it differently

> (inline again: should I just make this a static, the compiler can inline 
> where possible? or do you want a macro?)

I don't know where Zdenek got the idea that we have something against
"inline".

So far as I can see, recent versions of gcc claim to support
__builtin_clz on all supported architectures.  On some it might be no
faster than our existing loop, but it seems unlikely to be slower.

The two comments I have are

* do something other than the hardwired "32" for word size; perhaps
sizeof(int) * BITS_PER_BYTE.

* do not use the separate "fls" function.  On a compiler that fails to
inline it, this patch would be a net performance loss, which we're not
likely to tolerate for a patch that has no other reason to live than
performance.  Just #if the builtin right into the one place where it
will be used.
        regards, tom lane


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

Предыдущее
От: KaiGai Kohei
Дата:
Сообщение: Re: SE-PostgreSQL?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [PATCH 1/2 v3] [libpq] rework sigpipe-handling macros