Re: Use static inline functions for Float <-> Datum conversions
От | Heikki Linnakangas |
---|---|
Тема | Re: Use static inline functions for Float <-> Datum conversions |
Дата | |
Msg-id | 752262dc-0a51-22bd-9cfa-88532d2d8dc2@iki.fi обсуждение исходный текст |
Ответ на | Re: Use static inline functions for Float <-> Datum conversions (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: Use static inline functions for Float <-> Datum conversions
|
Список | pgsql-hackers |
On 08/31/2016 02:38 PM, Tom Lane wrote: > Heikki Linnakangas <hlinnaka@iki.fi> writes: >> 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. > > Looks good to me. Ok, will push. > I wonder whether there is a compiler-dependent way of avoiding the union > trick ... or maybe gcc is already smart enough that it doesn't matter? It seems to compile into a single instruction, so it can't get any better from a performance point of view. float8pl: .LFB79:.loc 1 871 0.cfi_startproc .LVL297: .LBB959: .LBB960:.loc 2 733 0movsd 40(%rdi), %xmm2 .LBE960: .LBE959: .LBB961: .LBB962:movsd 32(%rdi), %xmm1 ... A union is probably what language pedantics would prefer anyway, and anything else would be more of a trick. - Heikki
В списке pgsql-hackers по дате отправления: