From: | Nathan Bossart <nathan(at)postgresql(dot)org> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Inline pg_popcount() for small buffers. |
Date: | 2024-04-03 17:24:20 |
Message-ID: | E1rs4LU-000Kcm-DM@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
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(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2024-04-03 17:56:23 | pgsql: Split XLogCtl->LogwrtResult into separate struct members |
Previous Message | Heikki Linnakangas | 2024-04-03 16:34:32 | pgsql: Refactor how heap_prune_chain() updates prunable_xid |