Re: inline newNode()

From: Neil Conway <neilc(at)samurai(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: inline newNode()
Date: 2002-10-08 04:58:34
Message-ID: 87elb1plvp.fsf@mailbox.samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
[ snip interesting analysis ]
> A nicer approach would be to somehow make use of the datatype of the
> first argument to MemSet. If we could determine at compile time
> that it's supposed to point at a type with at least int alignment,
> then it'd be possible for the compiler to optimize away this check
> in a reasonably safe fashion. I'm not sure if there's a portable
> way to do this, though. There's no "alignof()" construct in C
> :-(. Any ideas?

Well, we could make use of (yet another) GCC-ism: the __alignof__
keyword, which is described here:

http://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/Alignment.html#Alignment

I don't like making the code GCC-specific any more than anyone else
does, but given that the code-bloat is specific to the inline version
of newNode (which in the scheme I described earlier would be
GCC-only) -- so introducing a GCC-specific fix for a GCC-specific
problem isn't too bad, IMHO.

Or we could just use your other suggestion: define a variant of
MemSet() and use it when we know it's safe. Not sure which is the
better solution: any comments?

Cheers,

Neil

--
Neil Conway <neilc(at)samurai(dot)com> || PGP Key ID: DB3C29FC

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Shridhar Daithankar 2002-10-08 05:44:11 Re: [pgsql-performance] Large databases, performance
Previous Message Bruce Momjian 2002-10-08 03:08:36 Re: Dirty Buffer Writing [was Proposed LogWriter Scheme]

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2002-10-08 15:53:52 Re: inline newNode()
Previous Message Bruce Momjian 2002-10-08 04:47:31 Re: Doc Updates