Introduce optimized routine for linear searches of arrays
John Naylor <john.naylor@postgresql.org>
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
Files
| Path | Change | +/− |
|---|---|---|
| src/include/port/pg_lfind.h | added | +103 −0 |
| src/test/modules/Makefile | modified | +1 −0 |
| src/test/modules/test_lfind/expected/test_lfind.out | added | +12 −0 |
| src/test/modules/test_lfind/.gitignore | added | +4 −0 |
| src/test/modules/test_lfind/Makefile | added | +23 −0 |
| src/test/modules/test_lfind/sql/test_lfind.sql | added | +8 −0 |
| src/test/modules/test_lfind/test_lfind--1.0.sql | added | +8 −0 |
| src/test/modules/test_lfind/test_lfind.c | added | +52 −0 |
| src/test/modules/test_lfind/test_lfind.control | added | +4 −0 |
Discussion
- optimize lookups in snapshot [sub]xip arrays 48 messages · 2022-07-13 → 2022-08-11