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@candle.pha.pa.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@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073