Re: Avoid stack frame setup in performance critical routines using tail calls

From: "Andres Freund" <andres(at)anarazel(dot)de>
To: "David Rowley" <dgrowleyml(at)gmail(dot)com>
Cc: "PostgreSQL Development" <pgsql-hackers(at)postgresql(dot)org>, "Robert Haas" <robertmhaas(at)gmail(dot)com>, "Michael Paquier" <michael(dot)paquier(at)gmail(dot)com>, "Tomas Vondra" <tv(at)fuzzy(dot)cz>
Subject: Re: Avoid stack frame setup in performance critical routines using tail calls
Date: 2021-07-20 07:03:51
Message-ID: 189e4a79-c477-44e0-b3a2-e242b491948d@www.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Mon, Jul 19, 2021, at 23:53, David Rowley wrote:
> On Tue, 20 Jul 2021 at 18:17, Andres Freund <andres(at)anarazel(dot)de> wrote:
> > Any chance you could show a `perf annotate AllocSetAlloc` and `perf annotate
> > palloc` from a patched run? And perhaps how high their percentages of the
> > total work are. E.g. using something like
> > perf report -g none|grep -E 'AllocSetAlloc|palloc|MemoryContextAlloc|pfree'
>
> Sure. See attached.
>
> David
>
> Attachments:
> * AllocateSetAlloc.txt
> * palloc.txt
> * percent.txt

Huh, that's interesting. You have some control flow enforcement stuff turned on (the endbr64). And it looks like it has a non zero cost (or maybe it's just skid). Did you enable that intentionally? If not, what compiler/version/distro is it? I think at least on GCC that's -fcf-protection=...

Andres

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2021-07-20 07:37:46 Re: Avoid stack frame setup in performance critical routines using tail calls
Previous Message David Rowley 2021-07-20 06:53:39 Re: Avoid stack frame setup in performance critical routines using tail calls