Re: More speedups for tuple deformation

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: John Naylor <johncnaylorls(at)gmail(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: More speedups for tuple deformation
Date: 2026-01-31 03:44:55
Message-ID: CAApHDvpsxOFV2V1BUfA-JNPXYdXAeq0y+Xi2Yh13+BonLLCOxQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, 31 Jan 2026 at 15:48, John Naylor <johncnaylorls(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message jian he 2026-01-31 03:50:50 pg_dumpall --roles-only interact with other options
Previous Message wenhui qiu 2026-01-31 03:02:47 Re: Change default of jit to off