Re: More speedups for tuple deformation - Mailing list pgsql-hackers

From David Rowley
Subject Re: More speedups for tuple deformation
Date
Msg-id CAApHDvpsxOFV2V1BUfA-JNPXYdXAeq0y+Xi2Yh13+BonLLCOxQ@mail.gmail.com
Whole thread Raw
In response to Re: More speedups for tuple deformation  (John Naylor <johncnaylorls@gmail.com>)
Responses Re: More speedups for tuple deformation
List pgsql-hackers
On Sat, 31 Jan 2026 at 15:48, John Naylor <johncnaylorls@gmail.com> wrote:
> +   res += __builtin_ctz(~bits[bytenum]);

> If bits[bytenum] is 255, then __builtin_ctz(0) is undefined. The top
> of the function says

Oops, I forgot to cast the byte to uint32 before the bitwise-not. I've
fixed locally. Still processing Andres' comments.

> + * We expect that 'bits' contains at least one 0 bit somewhere in the mask,
> + * not necessarily < natts.
>
> ...in which case it should be well defined everywhere. Am I missing
> something? If we need to handle the 255 case, this should work:
>
> pg_rightmost_one_pos32(~((uint32) bits[bytenum]))

I'd rather handle that in a single byte as the fallback path in that
function requires byte-at-a-time processing.

David



pgsql-hackers by date:

Previous
From: wenhui qiu
Date:
Subject: Re: Change default of jit to off
Next
From: jian he
Date:
Subject: pg_dumpall --roles-only interact with other options