Skip site navigation (1) Skip section navigation (2)

Re: inline newNode()

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>,Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>
Subject: Re: inline newNode()
Date: 2002-10-09 18:32:57
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-patches
Neil Conway wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)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?

Sure, I like those names.

> 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...

I think that was actually the goal, to not have them evaluated multiple
times, and perhaps bloat if the length itself was a macro.

New patch attached with your suggested renaming.  Now that I look at the
code, there are about 55 places where we call palloc then right after it
MemSet(0), so we could merge those to use palloc0 and reduce existing
MemSet code bloat some more.

  Bruce Momjian                        |
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

In response to

pgsql-hackers by date

Next:From: Laurette CisnerosDate: 2002-10-09 20:18:51
Subject: Re: pgsql 7.2.3 crash
Previous:From: Rod TaylorDate: 2002-10-09 18:13:26
Subject: Re: [GENERAL] Point in Time Recovery WAS: Hot Backup

pgsql-patches by date

Next:From: Peter EisentrautDate: 2002-10-09 21:13:47
Subject: Re: inline newNode()
Previous:From: Neil ConwayDate: 2002-10-09 18:01:56
Subject: Re: inline newNode()

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group