pgsql: Introduce optimized routine for linear searches of arrays

From: John Naylor <john(dot)naylor(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Introduce optimized routine for linear searches of arrays
Date: 2022-08-10 03:49:36
Message-ID: E1oLcit-0004Qs-68@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Introduce optimized routine for linear searches of arrays

Use SSE2 intrinsics to speed up the search, where available. Otherwise,
use a simple 'for' loop. The motivation to add this now is to speed up
XidInMVCCSnapshot(), which is the reason only unsigned 32-bit integer
arrays are optimized. Other types are left for future work, as is the
extension of this technique to non-x86 platforms.

Nathan Bossart

Reviewed by: Andres Freund, Bharath Rupireddy, Masahiko Sawada
Discussion: https://postgr.es/m/20220713170950.GA3116318%40nathanxps13

Branch
------
master

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

Modified Files
--------------
src/include/port/pg_lfind.h | 103 +++++++++++++++++++++
src/test/modules/Makefile | 1 +
src/test/modules/test_lfind/.gitignore | 4 +
src/test/modules/test_lfind/Makefile | 23 +++++
.../modules/test_lfind/expected/test_lfind.out | 12 +++
src/test/modules/test_lfind/sql/test_lfind.sql | 8 ++
src/test/modules/test_lfind/test_lfind--1.0.sql | 8 ++
src/test/modules/test_lfind/test_lfind.c | 52 +++++++++++
src/test/modules/test_lfind/test_lfind.control | 4 +
9 files changed, 215 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2022-08-10 09:16:12 pgsql: Remove unused short option from getopt_long() call
Previous Message Bruce Momjian 2022-08-10 00:38:19 pgsql: doc: mention that COPY MATCH requires columns _in_ _order_