Re: [GENERAL] Is float8 a reference type?

2017-09-23 Thread Paul A Jungwirth
On Sat, Sep 23, 2017 at 9:40 AM, Tom Lane wrote: > I wonder whether you're using up-to-date Postgres headers (ones > where Float8GetDatum is a static inline function). I'm building against 9.6.3 on both machines. I'm not doing anything special to change the compilation

Re: [GENERAL] Is float8 a reference type?

2017-09-23 Thread Tom Lane
Paul A Jungwirth 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

Re: [GENERAL] Is float8 a reference type?

2017-09-23 Thread Paul A Jungwirth
On Fri, Sep 22, 2017 at 8:38 PM, Tom Lane wrote: > "Premature optimization is the root of all evil". Do you have good reason > to think that it's worth your time to write unsafe/unportable code? Do > you know that your compiler doesn't turn Float8GetDatum into a no-op >

Re: [GENERAL] Is float8 a reference type?

2017-09-22 Thread Tom Lane
Paul A Jungwirth writes: > On Fri, Sep 22, 2017 at 8:05 PM, Pavel Stehule > wrote: >> I don't think so it is good idea to write 64bit only extensions. > I agree, but how about this?: "Premature optimization is the root of all evil". Do

Re: [GENERAL] Is float8 a reference type?

2017-09-22 Thread Pavel Stehule
2017-09-23 5:10 GMT+02:00 Paul A Jungwirth : > On Fri, Sep 22, 2017 at 8:05 PM, Pavel Stehule > wrote: > > yes, it is 8 bytes on 64-bit. > > Thanks! > > > I don't think so it is good idea to write 64bit only extensions. > > I agree, but how

Re: [GENERAL] Is float8 a reference type?

2017-09-22 Thread Paul A Jungwirth
On Fri, Sep 22, 2017 at 8:05 PM, Pavel Stehule wrote: > yes, it is 8 bytes on 64-bit. Thanks! > I don't think so it is good idea to write 64bit only extensions. I agree, but how about this?: if (FLOAT8PASSBYVAL) { datums = (Datum *)floats; } else {

Re: [GENERAL] Is float8 a reference type?

2017-09-22 Thread Pavel Stehule
2017-09-23 4:52 GMT+02:00 Paul A Jungwirth : > The docs say that a Datum can be 4 bytes or 8 depending on the machine: > > https://www.postgresql.org/docs/9.5/static/sql-createtype.html > > Is a Datum always 8 bytes for 64-bit architectures? > > And if so, can my C

Re: [GENERAL] Is float8 a reference type?

2017-09-22 Thread Paul A Jungwirth
On Fri, Sep 22, 2017 at 7:52 PM, Paul A Jungwirth wrote: > Is a Datum always 8 bytes for 64-bit architectures? Never mind, I found this in `pg_config.h`: /* float8, int8, and related values are passed by value if 'true', by reference if 'false' */