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

Re: inline newNode()

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Neil Conway <neilc(at)samurai(dot)com>,PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: inline newNode()
Date: 2002-10-09 21:15:23
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-patches
Peter Eisentraut wrote:
> Tom Lane writes:
> > If you use memset() instead of MemSet(), I'm afraid you're going to blow
> > off most of the performance gain this was supposed to achieve.
> Can someone explain to me why memset() would ever be better than MemSet()?

I am surprised MemSet was ever faster than memset().  Remember, MemSet
was done only to prevent excessive function call overhead to memset(). 
I never anticipated that a simple while() loop would be faster than the
libc version, especially ones that have assembler memset versions, but,
for example on Sparc, this is true.  

I looked at the Sparc assembler code and I can't see why MemSet would be
faster.  Perhaps someone can send over the Sparc assembler output of
MemSet on their platform and I can compare it to the Solaris assembler I
see here.  In fact, they can probably disassemble a memset() routine there
and see exactly what I see.

> Also, shouldn't GCC (at least 3.0 or later) inline memset() automatically?

Not sure, but yes, that may be true.  I think it requires a high
optimizer level, perhaps higher than our default.

> What's the result of using -finline (or your favorite compiler's
> inlining flag)?

Yes, that would be it.

> And has someone wondered why the GEQO code needs so many new nodes?
> Perhaps a more lightweight data representation for internal use could be
> appropriate?

I assume the GEQO results he is seeing is only for a tests, and that the
macro version of newNode will help in all cases.

  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: Magnus Naeslund(f)Date: 2002-10-09 21:34:16
Subject: Damn slow query
Previous:From: Peter EisentrautDate: 2002-10-09 21:13:47
Subject: Re: inline newNode()

pgsql-patches by date

Next:From: Tom LaneDate: 2002-10-10 04:00:59
Subject: Re: inline newNode()
Previous:From: Peter EisentrautDate: 2002-10-09 21:13:47
Subject: Re: inline newNode()

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