Re: src/port/snprintf.c: Optimize the common base=10 case in fmtint

Поиск
Список
Период
Сортировка
От Mark Dilger
Тема Re: src/port/snprintf.c: Optimize the common base=10 case in fmtint
Дата
Msg-id 92FF353A-B28A-4479-BFFE-35485CD6C94A@enterprisedb.com
обсуждение исходный текст
Ответ на src/port/snprintf.c: Optimize the common base=10 case in fmtint  (Arjan van de Ven <arjan@linux.intel.com>)
Ответы Re: src/port/snprintf.c: Optimize the common base=10 case in fmtint  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers

> On Oct 26, 2021, at 7:57 AM, Arjan van de Ven <arjan@linux.intel.com> wrote:
>
> By special casing the super common case of base==10, the (gcc) compiler can (and will)
> replace the divide by a multiply with 0xcccccccccccccccd, yielding a lot faster code.
> (fmtint dropped drastically in the perf profiles after this change)

It appears fmtint only has three options for base, being 10, 16, and 8.  Have you profiled with either of the others
specialcased as well?  I don't see much use in optimizing for octal, but hexadecimal is used quite a bit in wal with
patternslike "%08X%08X%08X". 

—
Mark Dilger
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company






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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Refactoring: join MakeSingleTupleTableSlot() and MakeTupleTableSlot()
Следующее
От: Andres Freund
Дата:
Сообщение: Re: src/port/snprintf.c: Optimize the common base=10 case in fmtint