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

From Andres Freund
Subject Re: [PATCH] unified frontend support for pg_malloc et al and palloc/pfree mulation (was xlogreader-v4)
Date
Msg-id 20130109170247.GC11725@awork2.anarazel.de
Whole thread Raw
In response to Re: [PATCH] unified frontend support for pg_malloc et al and palloc/pfree mulation (was xlogreader-v4)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [PATCH] unified frontend support for pg_malloc et al and palloc/pfree mulation (was xlogreader-v4)
List pgsql-hackers
On 2013-01-09 11:57:35 -0500, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > On 2013-01-09 11:37:46 -0500, Tom Lane wrote:
> >> I agree that what dirmod is doing is pretty ugly, but it's localized
> >> enough that I don't care particularly.  (Really, the only reason it's
> >> a hack and not The Solution is that at the moment there's only one
> >> file doing it that way.  A trampoline function for use only by code
> >> that needs to work in both frontend and backend isn't an unreasonable
> >> idea.)
> 
> > Well, after the patch the trampoline function would be palloc() itself.
> 
> My objection is that you're forcing *all* backend code to go through
> the trampoline.  That probably has a negative impact on performance, and
> if you think it'll get committed without a thorough proof that there's
> no such impact, you're mistaken.  Perhaps you're not aware of exactly
> how hot a hot-spot palloc is?  It's not unlikely that this patch could
> hurt backend performance by several percent all by itself.

There is no additional overhead except some minor increase in code size.
If you look at the patch palloc() now simply directly calls
CurrentMemoryContext->methods->alloc. So there is no additional function
call relative to the previous state.

Greetings,

Andres Freund

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



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Event Triggers: adding information
Next
From: Peter Eisentraut
Date:
Subject: Re: PL/perl should fail on configure, not make