Re: Use local buffer for packed numerics

From: Andrei Lepikhov <lepihov(at)gmail(dot)com>
To: David Geier <geidav(dot)pg(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andreas Karlsson <andreas(at)proxel(dot)se>
Subject: Re: Use local buffer for packed numerics
Date: 2026-11-20 13:07:25
Message-ID: beae8463-200e-4cbd-a6ed-30687026035e@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 20/11/2026 09:14, David Geier wrote:
>> It's attached. I saw really good results on x86 but some regressions on
>> M5. That's why I started working on centralizing the case distinction
>> work scattered throughout all the macros in set_var_from_num() and have
>> all functions use that. This also makes the code a lot nicer. This
>> change isn't complete yet, so I cannot send it to you.
>>
>> I'll share the results on my box with you tomorrow. Right now, I don't
>> have access to my benchmark machine.
>
> Attached are the results from my AMD Ryzen 7 9700X. You can see that
> there are lots of speedups but also lots of regressions. The regressions
> stem from the additional case distinction for if it's a packed /
> unpacked varlena that are repeatedly scattered throughout the code via
> the NUMERIC_ macros.
I wonder what your compiler is.
I test these numeric-related patches on Intel/AMD/ARM platforms with clang/gcc.
For GCC, I do recommend using -mstringop-strategy=libcall. It hides the
performance issue in GCC 12-15. For production code, I usually use a small,
non-committable hack that transforms memcpy(..,..,N) into a series of
memcpy(..,..,8).

--
regards, Andrei Lepikhov,
pgEdge

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2026-11-20 13:11:29 Re: [PATCH] pg_upgrade: add --initdb option to create the new cluster automatically
Previous Message Greg Sabino Mullane 2026-11-20 12:59:50 Re: [PATCH] pg_upgrade: add --initdb option to create the new cluster automatically