From: | "Alex Hunsaker" <badalex(at)gmail(dot)com> |
---|---|
To: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "Peter Eisentraut" <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org, "Stephen R(dot) van den Berg" <srb(at)cuci(dot)nl> |
Subject: | Re: Is it really such a good thing for newNode() to be a macro? |
Date: | 2008-08-29 22:46:58 |
Message-ID: | 34d269d40808291546w1ad3dcb1l2cf878efb218947e@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Aug 29, 2008 at 1:16 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Brendan Jurd | 2008-08-30 01:39:04 | to_date() validation |
Previous Message | Tom Lane | 2008-08-29 22:37:54 | Re: Is it really such a good thing for newNode() to be a macro? |