Re: Rethinking MemoryContext creation

From: ilmari(at)ilmari(dot)org (Dagfinn Ilmari =?utf-8?Q?Manns=C3=A5ker?=)
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Rethinking MemoryContext creation
Date: 2017-12-11 17:39:48
Message-ID: d8jwp1txixn.fsf@dalvik.ping.uio.no
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:

> On Mon, Dec 11, 2017 at 11:59 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com> writes:
>>> On 12/11/2017 05:27 PM, Tom Lane wrote:
>>>> However, unless we want to run around and touch all the ~ 150 calls
>>>> with constant arguments, we'd have to set things up so that the default
>>>> behavior for AllocSetContextCreate is to not copy. This risks breaking
>>>> callers in extensions. Not entirely sure if it's worth that --- any
>>>> thoughts?
>>
>>> I don't think silently breaking extensions is particularly attractive
>>> option, so I guess we'll have to run around and tweak the ~150 calls.
>>
>> Meh. I suppose that of the ~150 call sites, there are probably only
>> a dozen or two where it would actually make a performance difference,
>> so maybe this needn't be quite as invasive as I first thought.
>
> I think changing only a subset of the call sites is unappealing
> because, even though it may not make a measurable performance
> difference in other cases, it may get cargo-culted into some place
> where it does make a difference.

Would it be acceptable to only get this optimisation on compilers that
support __builtin_constant_p or similar? If so, the wrapper macro could
use that to automatically pass the no-copy flag when called with a
literal string.

- ilmari
--
"I use RMS as a guide in the same way that a boat captain would use
a lighthouse. It's good to know where it is, but you generally
don't want to find yourself in the same spot." - Tollef Fog Heen

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2017-12-11 17:40:55 Re: Inconsistency in plpgsql's error context reports
Previous Message Tom Lane 2017-12-11 17:38:21 Re: Rethinking MemoryContext creation