Re: make additional use of optimized linear search routines - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: make additional use of optimized linear search routines
Date
Msg-id YyqjvS3HumArAxwq@paquier.xyz
Whole thread Raw
In response to Re: make additional use of optimized linear search routines  (Michael Paquier <michael@paquier.xyz>)
Responses Re: make additional use of optimized linear search routines
List pgsql-hackers
On Sat, Sep 03, 2022 at 10:06:58AM +0900, Michael Paquier wrote:
> Ohoh.  This sounds like a good idea to me, close to what John has
> applied lately.  I'll take a closer look..

So, the two code paths patched here are rather isolated.  The one in
TransactionIdIsInProgress() requires an overflowed set of subxids
still running, something similar to what the isolation test
subxid-overflow does.  XidIsConcurrent() is also kind of hard to
reason about with a benchmark.

Anyway, I did not know about the work done with SIMD instructions in
pg_lfind.h and after playing the API I have run some micro benchmarks
with on pg_lfind32() and I can see some improvements.  With a range of
100~10k elements in a fixed number of repeated calls with a for loop
and lfind(), I could not get up to the 40% speedup.  That was somewhat
closer to 15%~20% on x86 and 20%~25% with arm64.  There is a trend
where things got better with a higher number of elements with
lfind().

In short, switching those code paths to use the linear search routines
looks like a good thing in the long-term, so I would like to apply
this patch.  If you have any comments or objections, please feel
free.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: [PATCH]Feature improvement for MERGE tab completion
Next
From: Fujii Masao
Date:
Subject: Re: Fix snapshot name for SET TRANSACTION documentation