From: | Heikki Linnakangas <hlinnaka(at)iki(dot)fi> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Use static inline functions for Float <-> Datum conversions |
Date: | 2016-08-31 12:22:30 |
Message-ID: | 752262dc-0a51-22bd-9cfa-88532d2d8dc2@iki.fi |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 08/31/2016 02:38 PM, Tom Lane wrote:
> Heikki Linnakangas <hlinnaka(at)iki(dot)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 0
movsd 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
From | Date | Subject | |
---|---|---|---|
Next Message | Daniel Gustafsson | 2016-08-31 12:45:42 | Leftover member in openssl part of Port struct |
Previous Message | Tom Lane | 2016-08-31 11:38:34 | Re: Use static inline functions for Float <-> Datum conversions |