Introduce optimized routine for linear searches of arrays
authorJohn Naylor <[email protected]>
Wed, 3 Aug 2022 16:49:04 +0000 (09:49 -0700)
committerJohn Naylor <[email protected]>
Wed, 10 Aug 2022 03:48:29 +0000 (10:48 +0700)
commitb6ef167564905e8dab8af1b1dba0997ec61204ca
tree9a2d2cc792c48588214a9e9dc8f7adfd68905667
parent356dd2ce5b7b0f3ea11e016f73b1f173604b8452
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
src/include/port/pg_lfind.h [new file with mode: 0644]
src/test/modules/Makefile
src/test/modules/test_lfind/.gitignore [new file with mode: 0644]
src/test/modules/test_lfind/Makefile [new file with mode: 0644]
src/test/modules/test_lfind/expected/test_lfind.out [new file with mode: 0644]
src/test/modules/test_lfind/sql/test_lfind.sql [new file with mode: 0644]
src/test/modules/test_lfind/test_lfind--1.0.sql [new file with mode: 0644]
src/test/modules/test_lfind/test_lfind.c [new file with mode: 0644]
src/test/modules/test_lfind/test_lfind.control [new file with mode: 0644]