Re: Performance optimization of btree binary search - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Performance optimization of btree binary search
Date
Msg-id 20131205160517.GC3866@alap2.anarazel.de
Whole thread Raw
In response to Re: Performance optimization of btree binary search  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Performance optimization of btree binary search  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 2013-12-05 10:34:16 -0500, Tom Lane wrote:
> Andres Freund <andres@2ndquadrant.com> writes:
> > I was actually thinking about making Datum (and some other types we
> > have) structs or unions. Currently it's far, far to easy to mix them. We throw
> > away pretty much all of the little typesafety C has by typedef'ing them
> > to integral types with lots of autocasting behaviour.
> 
> That's intentional; on many ABIs, making Datum a struct would be
> catastrophic performance-wise because it would not be eligible for simple
> register pass or return conventions.

Unions should behave saner in that regard tho? And it be fairly easy to
make it an optional thing.

> In any case, the number of bugs I can remember that such a thing
> would've prevented is negligible.

Cases talked about upthread, where a plain datatype is returned as a
Datum instead of using FooGetDatum() and the reverse, would be
impossible. I don't think those are that infrequent?

Greetings,

Andres Freund

-- Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



pgsql-hackers by date:

Previous
From: Metin Doslu
Date:
Subject: Re: Parallel Select query performance and shared buffers
Next
From: Tom Lane
Date:
Subject: Re: Performance optimization of btree binary search