Re: inline newNode() - Mailing list pgsql-patches

From Neil Conway
Subject Re: inline newNode()
Date
Msg-id 87lm57o5ij.fsf@mailbox.samurai.com
Whole thread Raw
In response to Re: inline newNode()  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: inline newNode()  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-patches
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> OK, here's a patch for testing.  It needs cleanup because the final
> version would remove the nodes/nodes.c file.  The net effect of the
> patch is to make newNode a macro with little code bloat.

Ok, I think this is the better version. The performance seems to be
about the same as my original patch, and the code bloat is a lot less:
12857787 with the patch versus 12845168 without it. The
implemementation (with a global variable) is pretty ugly, but I don't
really see a way around that...

One minor quibble with the patch though: MemoryContextAllocC() and
pallocC() aren't very good function names, IMHO. Perhaps
MemoryContextAllocZero() and palloc0() would be better?

This isn't specific to your patch, but it occurs to me that we could
save a few bits of code bloat if we removed the '_len' variable
declaration from the MemSet() macro -- it isn't needed, AFAICT. That
would mean we we'd evaluate the 'len' argument multiple times, so I'm
not sure if that's a win overall...

Cheers,

Neil

--
Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: pltcl and plpython memory leak revisited (fwd)
Next
From: Bruce Momjian
Date:
Subject: Re: inline newNode()