pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Simplify newNode() by removing special cases
Date: Tue, 19 Dec 2023 10:12:05 +0000
Message-ID: <E1rFX53-00AuVu-5r@gemulon.postgresql.org> (raw)

Simplify newNode() by removing special cases

- Remove MemoryContextAllocZeroAligned(). It was supposed to be a
  faster version of MemoryContextAllocZero(), but modern compilers turn
  the MemSetLoop() into a call to memset() anyway, making it more or
  less identical to MemoryContextAllocZero(). That was the only user of
  MemSetTest, MemSetLoop, so remove those too, as well as palloc0fast().

- Convert newNode() to a static inline function. When this was
  originally originally written, it was written as a macro because
  testing showed that gcc didn't inline the size check as we
  intended. Modern compiler versions do, and now that it just calls
  palloc0() there is no size-check to inline anyway.

One nice effect is that the palloc0() takes one less argument than
MemoryContextAllocZeroAligned(), which saves a few instructions in the
callers of newNode().

Reviewed-by: Peter Eisentraut, Tom Lane, John Naylor, Thomas Munro
Discussion: https://www.postgresql.org/message-id/b51f1fa7-7e6a-4ecc-936d-90a8a1659e7c@iki.fi

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3c080fb4fad3e1c1e34f74a7b84a443137adc9f2

Modified Files
--------------
src/backend/nodes/Makefile    |  1 -
src/backend/nodes/meson.build |  1 -
src/backend/nodes/nodes.c     | 31 -------------------------------
src/backend/utils/mmgr/mcxt.c | 38 --------------------------------------
src/include/c.h               | 24 ------------------------
src/include/nodes/nodes.h     | 39 +++++++++------------------------------
src/include/utils/palloc.h    | 14 --------------
7 files changed, 9 insertions(+), 139 deletions(-)



Message-ID: <E1rFX53-00AuVu-5r@gemulon.postgresql.org>
Permalink:  ../E1rFX53-00AuVu-5r@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1rFX53-00AuVu-5r@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: heikki.linnakangas@iki.fi, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Simplify newNode() by removing special cases
  In-Reply-To: <E1rFX53-00AuVu-5r@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox