Re: Manipulating complex types as non-contiguous structures in-memory
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: Pavel Stehule <pavel.stehule@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2015-05-14T00:28:52Z
Lists: 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
Commits
-
Use fast path in plpgsql's RETURN/RETURN NEXT in more cases.
- 9e3ad1aac524 9.5.0 cited
-
Add support for multiple kinds of external toast datums.
- 368202501539 9.4.0 cited