Skip site navigation (1) Skip section navigation (2)

Re: Re: [PATCH] unified frontend support for pg_malloc et al and palloc/pfree mulation (was xlogreader-v4)

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>,pgsql-hackers(at)postgresql(dot)org
Subject: Re: Re: [PATCH] unified frontend support for pg_malloc et al and palloc/pfree mulation (was xlogreader-v4)
Date: 2013-01-13 19:06:37
Message-ID: 20130113190637.GE26173@awork2.anarazel.de (view raw or flat)
Thread:
Lists: pgsql-hackers
On 2013-01-12 16:36:39 -0500, Tom Lane wrote:
> Andres Freund <andres(at)2ndquadrant(dot)com> writes:
> >>> It does *not* combine elog_start and elog_finish into one function if
> >>> varargs are available although that brings a rather measurable
> >>> size/performance benefit.
> 
> >> Since you've apparently already done the measurement: how much?
> >> It would be a bit tedious to support two different infrastructures for
> >> elog(), but if it's a big enough win maybe we should.
> 
> > Imo its pretty definitely a big enough win. So big I have a hard time
> > believing it can be true without negative effects somewhere else.
> 
> Well, actually there's a pretty serious negative effect here, which is
> that when it's implemented this way it's impossible to save errno for %m
> before the elog argument list is evaluated.  So I think this is a no-go.
> We've always had the contract that functions in the argument list could
> stomp on errno without care.
> 
> If we switch to a do-while macro expansion it'd be possible to do
> something like
> 
> 	do {
> 		int save_errno = errno;
> 		int elevel = whatever;
> 
> 		elog_internal( save_errno, elevel, fmt, __VA__ARGS__ );
> 	} while (0);
> 
> but this would almost certainly result in more code bloat not less,
> since call sites would now be responsible for fetching errno.

the numbers are:
old definition:                                 10393.658ms, 5497912 bytes
old definition + unreachable:                   10011.102ms, 5469144 bytes
stmt, two calls, unreachable:                   10036.132ms, 5468792 bytes
stmt, one call, unreachable:                    9443.612ms,  5462232 bytes
stmt, one call, unreachable, save errno:        9615.863ms,  5489688 bytes

So while not saving errno is unsurprisingly better its still a win.

Greetings,

Andres Freund

-- 
 Andres Freund	                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


In response to

Responses

pgsql-hackers by date

Next:From: Mark HellegersDate: 2013-01-13 19:08:01
Subject: Re: Porting to Haiku
Previous:From: Tom LaneDate: 2013-01-13 18:41:36
Subject: Re: [PATCH] unified frontend support for pg_malloc et al and palloc/pfree mulation (was xlogreader-v4)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group