Re: MemSet inline for newNode

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: MemSet inline for newNode
Date: 2002-11-12 01:17:58
Message-ID: 200211120117.gAC1Hwg13084@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches


I just ran a test on catalog/index.c and found that with the new patch,
the conditional test is completely gone. It now calls the palloc0
memory allocator unconditionally because all the conditions are met by
constants:

BuildIndexInfo:
pushl %ebp
movl %esp,%ebp
subl $32,%esp
pushl %esi
pushl %ebx
addl $-8,%esp
pushl $108
movl CurrentMemoryContext,%eax
pushl %eax
call MemoryContextAllocPalloc0

and, in MemoryContextAllocPalloc0, the inline MemSet loop is used
unconditionally.

---------------------------------------------------------------------------

Bruce Momjian wrote:
> Tom Lane wrote:
> > Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > > I can't do MemSet in a macro that returns a value, as palloc requires.
> > > MemSet has a loop, and that can't be done in a macro that returns a value.
> >
> > Hm. How did Neil test this originally --- was he relying on being able
> > to "inline" newNode()?
>
> Yes.
>
> > Anyway, I don't think that passing an extra parameter can be a win.
> > If there has to be a runtime test, testing whether the two low bits
> > of the length are zero is probably about the same speed as testing a
> > boolean parameter. It's unlikely to be enough slower to justify the
> > cost of passing another parameter.
>
> OK, new version attached, with extra parameter removed.
>

--
Bruce Momjian | http://candle.pha.pa.us
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

Browse pgsql-hackers by date

  From Date Subject
Next Message am 2002-11-12 01:20:52 geometry test failed (beta5 on Debian)
Previous Message Tom Lane 2002-11-11 22:56:19 "Uninitialized page" bug mechanism identified

Browse pgsql-patches by date

  From Date Subject
Next Message am 2002-11-12 01:20:52 geometry test failed (beta5 on Debian)
Previous Message Peter Eisentraut 2002-11-11 20:28:26 Re: pgsql-server/src Makefile.global.in makefiles/ ...