Re: Manipulating complex types as non-contiguous structures in-memory

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Manipulating complex types as non-contiguous structures in-memory
Date: 2015-05-14 00:48:51
Message-ID: 12650.1431564531@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)anarazel(dot)de> writes:
> On 2015-05-10 12:09:41 -0400, Tom Lane wrote:
>> Andres Freund <andres(at)anarazel(dot)de> writes:
>>> * The VARTAG_IS_EXPANDED(tag) trick in VARTAG_SIZE is unlikely to
>>> beneficial, before the compiler could implement the whole thing as a
>>> computed goto or lookup table, afterwards not.

>> Well, if you're worried about the speed of VARTAG_SIZE() then the right
>> thing to do would be to revert your change that made enum vartag_external
>> distinct from the size of the struct, so that we could go back to just
>> using the second byte of a varattrib_1b_e datum as its size. As I said
>> at the time, inserting pad bytes to force each different type of toast
>> pointer to be a different size would probably be a better tradeoff than
>> what commit 3682025015 did.

> I doubt that'd be a net positive. Anyway, all I'm saying is that I can't
> see the VARTAG_IS_EXPANDED trick being beneficial in comparison to
> checking both explicit values.

I did some microbenchmarking on this, and AFAICT doing it your way makes
it slower.

I still think that going back to defining the second byte as the size
would be better. Fortunately, since this is only a matter of in-memory
representations, we aren't committed to any particular answer.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2015-05-14 00:53:01 Re: Manipulating complex types as non-contiguous structures in-memory
Previous Message Kouhei Kaigai 2015-05-14 00:46:05 Re: Triaging the remaining open commitfest items