Re: [PATCH] Add pg_lfind8_nonzero()

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: cca5507 <cca5507(at)qq(dot)com>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] Add pg_lfind8_nonzero()
Date: 2025-12-17 15:09:42
Message-ID: 87dd2977-2cb3-4d6a-86b0-8392d20dc693@eisentraut.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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);

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2025-12-17 15:11:38 Re: Fwd: [PATCH] Add zstd compression for TOAST using extended header format
Previous Message Andres Freund 2025-12-17 15:00:01 Re: Flaky 003_start_stop.pl test