Re: Manipulating complex types as non-contiguous structures in-memory - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Manipulating complex types as non-contiguous structures in-memory
Date
Msg-id 1462.1431563332@sss.pgh.pa.us
Whole thread Raw
In response to Re: Manipulating complex types as non-contiguous structures in-memory  (Andres Freund <andres@anarazel.de>)
Responses Re: Manipulating complex types as non-contiguous structures in-memory  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> On 2015-05-10 12:09:41 -0400, Tom Lane wrote:
>>> * I find the ARRAY_ITER_VARS/ARRAY_ITER_NEXT macros rather ugly. I don't
>>> buy the argument that turning them into functions will be slower. I'd
>>> bet the contrary on common platforms.

>> Perhaps; do you want to do some testing and see?

> I've added new iterator functions using a on-stack state variable and
> array_iter_setup/next functions pretty analogous to the macros. And then
> converted arrayfuncs.c to use them.

I confirm that this doesn't seem to be any slower (at least not on a
compiler with inline functions).  And it's certainly less ugly, so I've
adopted it.

> Similarly using inline funcs for AARR_NDIMS/HASNULL does not appear to
> hamper performance and gets rid of the multiple evaluation risk.

I'm less excited about that part though.  The original ARR_FOO macros
mostly have multiple-evaluation risks as well, and that's been totally
academic so far.  By the time you get done dealing with the
STATIC_IF_INLINE dance, it's quite messy to have these be inline
functions, and I am not seeing a useful return from adding the mess.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Fabrízio de Royes Mello
Date:
Subject: Re: Proposal : REINDEX xxx VERBOSE
Next
From: Andres Freund
Date:
Subject: Re: Manipulating complex types as non-contiguous structures in-memory