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