Re: use CLZ instruction in AllocSetFreeIndex()

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: use CLZ instruction in AllocSetFreeIndex()
Дата
Msg-id 20191227132150.GA22238@alvherre.pgsql
обсуждение исходный текст
Ответ на use CLZ instruction in AllocSetFreeIndex()  (John Naylor <john.naylor@2ndquadrant.com>)
Ответы Re: use CLZ instruction in AllocSetFreeIndex()  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 2019-Dec-26, John Naylor wrote:

> In commit ab5b4e2f9ed, we optimized AllocSetFreeIndex() using a lookup
> table. At the time, using CLZ was rejected because compiler/platform
> support was not widespread enough to justify it. For other reasons, we
> recently added bitutils.h which uses __builtin_clz() where available,
> so it makes sense to revisit this. I modified the test in [1] (C files
> attached), using two separate functions to test CLZ versus the
> open-coded algorithm of pg_leftmost_one_pos32().
> 
> These are typical results on a recent Intel platform:
> 
> HEAD        5.55s
> clz         4.51s
> open-coded  9.67s

I can confirm these results on my Intel laptop.  I ran it with a
repetition of 20, averages of 4 runs:

clz        1,614
bitutils    3,714
current        2,088
(stddevs are under 0,031).


-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Libpq support to connect to standby server as priority
Следующее
От: Tom Lane
Дата:
Сообщение: Re: use CLZ instruction in AllocSetFreeIndex()