make additional use of optimized linear search routines

Nathan Bossart <nathandbossart@gmail.com>

From: Nathan Bossart <nathandbossart@gmail.com>
To: pgsql-hackers@postgresql.org
Date: 2022-09-01T18:51:53Z
Lists: pgsql-hackers

Attachments

Hi hackers,

Now that we have some optimized linear search routines [0], I thought I'd
quickly check whether we could use them elsewhere.  To start, I took
another look at a previously posted patch [1] and noticed two potentially
useful applications of pg_lfind32().  The attached patches replace the
open-coded linear searches with calls to pg_lfind32().  I haven't done any
performance analysis with these patches yet, and the overall impact might
be limited, but it seemed like low-hanging fruit.

I'm hoping to spend a bit more time looking for additional applications of
the pg_lfind*() suite of functions (and anywhere else where SIMD might be
useful, really).  If you have any ideas in mind, I'm all ears.

[0] https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/include/port/pg_lfind.h
[1] https://postgr.es/m/20220802221301.GA742739%40nathanxps13

-- 
Nathan Bossart
Amazon Web Services: https://aws.amazon.com

Commits

  1. Used optimized linear search in more code paths