pgsql: Use static inline functions for float <-> Datum conversions.

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Use static inline functions for float <-> Datum conversions.
Date: 2016-08-31 13:03:38
Message-ID: E1bf5B4-0003vG-0N@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Use static inline functions for float <-> Datum conversions.

Now that we are OK with using static inline functions, we can use them
to avoid function call overhead of pass-by-val versions of Float4GetDatum,
DatumGetFloat8, and Float8GetDatum. Those functions are only a few CPU
instructions long, but they could not be written into macros previously,
because we need a local union variable for the conversion.

I kept the pass-by-ref versions as regular functions. They are very simple
too, but they call palloc() anyway, so shaving a few instructions from the
function call doesn't seem so important there.

Discussion: <dbb82a4a-2c15-ba27-dd0a-009d2aa72b77(at)iki(dot)fi>

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/14cca1bf8e31ed39dbc26dd6c610f1113e759972

Modified Files
--------------
src/backend/utils/fmgr/fmgr.c | 63 +++++--------------------------------------
src/include/postgres.h | 63 +++++++++++++++++++++++++++++++++++++++++--
2 files changed, 67 insertions(+), 59 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Simon Riggs 2016-08-31 13:24:13 Re: [COMMITTERS] pgsql: Fix pg_receivexlog --synchronous
Previous Message Tom Lane 2016-08-31 12:52:36 pgsql: Prevent starting a standalone backend with standby_mode on.

Browse pgsql-hackers by date

  From Date Subject
Next Message Maksim Milyutin 2016-08-31 13:09:15 Re: [WIP] Patches to enable extraction state of query execution from external session
Previous Message Tom Lane 2016-08-31 12:55:13 Re: standalone backend PANICs during recovery