pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nathan Bossart <nathan@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Inline pg_popcount() for small buffers.
Date: Wed, 03 Apr 2024 17:24:20 +0000
Message-ID: <E1rs4LU-000Kcm-DM@gemulon.postgresql.org> (raw)

Inline pg_popcount() for small buffers.

If there aren't many bytes to process, the function call overhead
of the optimized implementation isn't worth taking, so instead we
inline a loop that consults pg_number_of_ones in that case.  If
there are many bytes to process, we accept the function call
overhead because the optimized versions are likely to be faster.
The threshold at which we use the optimized implementation is set
to the smallest amount of data required to use special popcount
instructions.

Reviewed-by: Alvaro Herrera, Tom Lane
Discussion: https://postgr.es/m/20240402155301.GA2750455%40nathanxps13

Branch
------
master

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

Modified Files
--------------
src/include/port/pg_bitutils.h | 38 ++++++++++++++++++++++++++++++++++++--
src/port/pg_bitutils.c         | 12 ++++++------
2 files changed, 42 insertions(+), 8 deletions(-)



Message-ID: <E1rs4LU-000Kcm-DM@gemulon.postgresql.org>
Permalink:  ../E1rs4LU-000Kcm-DM@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1rs4LU-000Kcm-DM@gemulon.postgresql.org

 · 

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: pgsql-committers@postgresql.org
  Cc: nathan@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Inline pg_popcount() for small buffers.
  In-Reply-To: <E1rs4LU-000Kcm-DM@gemulon.postgresql.org>

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

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