Re: [PATCH] Add pg_lfind8_nonzero() - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: [PATCH] Add pg_lfind8_nonzero()
Date
Msg-id 87dd2977-2cb3-4d6a-86b0-8392d20dc693@eisentraut.org
Whole thread Raw
In response to [PATCH] Add pg_lfind8_nonzero()  ("cca5507" <cca5507@qq.com>)
Responses Re: [PATCH] Add pg_lfind8_nonzero()
List pgsql-hackers
On 14.12.25 14:33, cca5507 wrote:
> With pg_lfind8_nonzero(), we can write the code like this:
> 
> ```
>     if (likely(numberOfAttributes > 0))
>         hasnull = pg_lfind8_nonzero((uint8 *) isnull, numberOfAttributes);
> ```
> 
> The pg_lfind8_nonzero() is faster because we can handle 8 bool values at a time.

Maybe you could try popcount for this?

     hasnull = (pg_popcount((char *) isnull, numberOfAttributes) > 0);




pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Flaky 003_start_stop.pl test
Next
From: Peter Eisentraut
Date:
Subject: Re: Fwd: [PATCH] Add zstd compression for TOAST using extended header format