Re: optimize lookups in snapshot [sub]xip arrays - Mailing list pgsql-hackers

From Andres Freund
Subject Re: optimize lookups in snapshot [sub]xip arrays
Date
Msg-id 20220805220434.6h2aa7eww5rxird6@awork3.anarazel.de
Whole thread Raw
In response to Re: optimize lookups in snapshot [sub]xip arrays  (Nathan Bossart <nathandbossart@gmail.com>)
Responses Re: optimize lookups in snapshot [sub]xip arrays
List pgsql-hackers
Hi,

On 2022-08-05 13:25:10 -0700, Nathan Bossart wrote:
> I went ahead and renamed it to pg_lfind32() and switched it back to
> returning the pointer.  That felt the cleanest from the naming perspective,
> but as Andres noted, it might not be as fast as just looking for the
> presence of the element.  I modified my small testing program to perform
> many searches on small arrays, and I wasn't able to identify any impact, so
> perhaps thіs is good enough.

Why on small arrays? I'd expect a difference mainly if it there's at least a
few iterations.

But mainly I'd expect to find a difference if the SIMD code were optimized a
further on the basis of not needing to return the offset. E.g. by
replacing _mm_packs_epi32 with _mm_or_si128, that's cheaper.

- Andres



pgsql-hackers by date:

Previous
From: Justin Pryzby
Date:
Subject: Re: Proposal to provide the facility to set binary format output for specific OID's per session
Next
From: Andres Freund
Date:
Subject: Re: Cleaning up historical portability baggage