On 08/31/2016 02:38 PM, Tom Lane wrote:
Heikki Linnakangas <hlinn...@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 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



--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to