Re: Is it really such a good thing for newNode() to be a macro? - Mailing list pgsql-hackers

From Alex Hunsaker
Subject Re: Is it really such a good thing for newNode() to be a macro?
Date
Msg-id 34d269d40808291546w1ad3dcb1l2cf878efb218947e@mail.gmail.com
Whole thread Raw
In response to Re: Is it really such a good thing for newNode() to be a macro?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Is it really such a good thing for newNode() to be a macro?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Fri, Aug 29, 2008 at 1:16 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> In theory the above implementation of newNode should be a clear win,
> so I'm thinking this result must be an artifact of some kind.  I'm
> going to go try it on PPC and HPPA machines next; does anyone want to
> try it on something else?

Hrm, I tried it on my x86_64 (quad core 2.66ghz, sorry no exotic
machines here :)) and did not see any real noticeable difference
between the two...

Here is what I tried:
(all with ./configure --enable-debug and make clean in between)

CVS HEAD:
tps = 30.375794
tps = 31.138078
tps = 30.928565

#define newNode(size, tag) \
({  Node *newNodeMacroHolder; \  AssertMacro((size) >= sizeof(Node));        /* need the tag, at least */ \
newNodeMacroHolder= (Node *) palloc0fast(size); \  newNodeMacroHolder->type = (tag); \  newNodeMacroHolder; \
 
})

tps = 30.814628
tps = 30.706080
tps = 31.10788

static inline Node *newNode(Size size, NodeTag tag)
{Node *newNode;Assert(size >= sizeof(Node));newNode = (Node *) palloc0(size);newNode->type = tag;return newNode;
}

tps = 30.317978
tps = 30.786187
tps = 30.747112


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Is it really such a good thing for newNode() to be a macro?
Next
From: Tom Lane
Date:
Subject: Re: Is it really such a good thing for newNode() to be a macro?