From: | Andres Freund <andres(at)anarazel(dot)de> |
---|---|
To: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
Cc: | Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Changing default -march landscape |
Date: | 2024-07-31 21:05:28 |
Message-ID: | 20240731210528.iyz7xtm7l6smabhu@awork3.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
On 2024-07-30 21:59:44 -0500, Nathan Bossart wrote:
> On Tue, Jul 30, 2024 at 07:39:18PM -0700, Andres Freund wrote:
> > We can hide most of the dispatch cost in a static inline function that only
> > does the runtime test if size is large enough - the size is a compile time
> > constant most of the time, which optimizes away the dispatch cost most of the
> > time. And even if not, an inlined runtime branch is a *lot* cheaper than an
> > indirect function call.
>
> I ended up doing precisely this for pg_popcount()/pg_popcount_masked(),
> although not quite as sophisticated as what you propose below. I'll look
> into expanding on this strategy in v18.
I think you subsume that under "not quite as sophisticated", but just to make
clear: The most important bits are to
a) do the dispatch in a header, without an indirect function call
b) implement intrinsic using stuff in a header if it's using a size argument
or such, because that allows to compiler to optimize away size checks in
the very common case of such an argument being a compile time constant.
Greetings,
Andres Freund
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2024-07-31 21:28:03 | Re: can we mark upper/lower/textlike functions leakproof? |
Previous Message | Andres Freund | 2024-07-31 20:57:55 | Re: pg_verifybackup: TAR format backup verification |