Use static inline functions for Float <-> Datum conversions

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Use static inline functions for Float <-> Datum conversions
Дата
Msg-id dbb82a4a-2c15-ba27-dd0a-009d2aa72b77@iki.fi
обсуждение исходный текст
Ответы Re: Use static inline functions for Float <-> Datum conversions  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi,

Now that we are OK with static inline functions, we can save some cycles
from floating-point functions, by turning Float4GetDatum,
Float8GetDatum, and DatumGetFloat8 into static inlines. They are only a
few instructions, but couldn't be implemented as macros before, because
they need a local union-variable for the conversion.

That can add up to significant speedups with float-heavy queries. For
example:

create table floats as select g::float8 as a, g::float8 as b, g::float8
as c from generate_series(1, 1000000) g;

select sum(a+b+c+1) from floats;

The sum query is about 4% faster on my laptop with this patch.

- Heikki

Вложения

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

Предыдущее
От: Fujii Masao
Дата:
Сообщение: Re: GIN logging GIN_SEGMENT_UNMODIFIED actions?
Следующее
От: Fabrízio de Royes Mello
Дата:
Сообщение: Re: Exclude schema during pg_restore