public inbox for [email protected]  
help / color / mirror / Atom feed
From: Nathan Bossart <[email protected]>
To: [email protected]
Subject: pgsql: Remove specialized word-length popcount implementations.
Date: Thu, 12 Feb 2026 17:34:25 +0000
Message-ID: <[email protected]> (raw)

Remove specialized word-length popcount implementations.

The uses of these functions do not justify the level of
micro-optimization we've done and may even hurt performance in some
cases (e.g., due to using function pointers).  This commit removes
all architecture-specific implementations of pg_popcount{32,64} and
converts the portable ones to inlined functions in pg_bitutils.h.
These inlined versions should produce the same code as before (but
inlined), so in theory this is a net gain for many machines.  A
follow-up commit will replace the remaining loops over these
word-length popcount functions with calls to pg_popcount(), further
reducing the need for architecture-specific implementations.

Suggested-by: John Naylor <[email protected]>
Reviewed-by: John Naylor <[email protected]>
Reviewed-by: Greg Burd <[email protected]>
Discussion: https://postgr.es/m/CANWCAZY7R%2Biy%2Br9YM_sySNydHzNqUirx1xk0tB3ej5HO62GdgQ%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a4688988835f1f5e607040c8d89e52cbfba9369b

Modified Files
--------------
src/include/port/pg_bitutils.h | 75 ++++++++++++++++++++++++++++--------------
src/port/pg_bitutils.c         | 65 ++----------------------------------
src/port/pg_popcount_aarch64.c | 20 +++--------
src/port/pg_popcount_x86.c     | 43 +-----------------------
4 files changed, 59 insertions(+), 144 deletions(-)



reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: pgsql: Remove specialized word-length popcount implementations.
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox