Re: Is float8 a reference type?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Paul A Jungwirth <pj(at)illuminatedcomputing(dot)com>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, pgsql <pgsql-general(at)postgresql(dot)org>
Subject: Re: Is float8 a reference type?
Date: 2017-09-23 16:40:24
Message-ID: 27465.1506184824@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Paul A Jungwirth <pj(at)illuminatedcomputing(dot)com> writes:
> Since I'm expecting ~10 million elements per array, it seems like
> skipping the conversion will have a real effect. I checked the
> assembly and do see a difference (on both Mac+clang and Linux+gcc).

I wonder whether you're using up-to-date Postgres headers (ones
where Float8GetDatum is a static inline function). For me, both
of those platforms recognize it as a no-op --- in fact, clang
turns a loop like

for (i = 0; i < n; i++) {
datums[i] = Float8GetDatum(floats[i]);
}

into something that looks suspiciously like an inlined, loop-unrolled
memcpy().

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Paul A Jungwirth 2017-09-23 17:09:08 Re: Is float8 a reference type?
Previous Message Tom Lane 2017-09-23 15:47:58 Re: Adding Cyrillic support