From: | Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com> |
---|---|
To: | David Rowley <dgrowleyml(at)gmail(dot)com> |
Cc: | Michael Paquier <michael(at)paquier(dot)xyz>, Peter Smith <smithpb2250(at)gmail(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: define pg_structiszero(addr, s, r) |
Date: | 2024-11-04 09:50:05 |
Message-ID: | ZyiYzakU83uFMfX0@ip-10-97-1-34.eu-west-3.compute.internal |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
On Fri, Nov 01, 2024 at 12:50:10PM +0000, Bertrand Drouvot wrote:
> Hi,
>
> On Fri, Nov 01, 2024 at 09:47:05PM +1300, David Rowley wrote:
> > On Fri, 1 Nov 2024 at 20:49, Michael Paquier <michael(at)paquier(dot)xyz> wrote:
> > I've attached what I thought a more optimal version might look like in
> > case anyone thinks making it better is a good idea.
> >
>
> Thanks for the proposal!
>
> I like the idea, I think that's worth to add a few comments, something like:
>
> 1 ===
>
> + while (((uintptr_t) p & (sizeof(size_t) - 1)) != 0)
>
> Add a comment like "Checks bytes, byte by byte, until the pointer is aligned"?
>
> 2 ===
>
> + for (; p < aligned_end; p += sizeof(size_t))
>
> Add a comment like "Multiple bytes comparison(s) at once"?
>
> 3 ===
>
> + while (p < end)
> + {
>
> Add a comment like "Compare remaining bytes, byte by byte"?
>
> 4 ===
>
> Out of curiosity I did test your proposal and it performs well (see [0]) for
> the PageIsVerifiedExtended() case.
Also,
5 ===
Shouldn't we handle the cases where ptr is NULL and/or len == 0? (should probably
have already been done in the current version of pg_memory_is_all_zeros() though).
Regards,
--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Kapila | 2024-11-04 10:01:09 | Re: Pgoutput not capturing the generated columns |
Previous Message | Michael Paquier | 2024-11-04 09:49:04 | Re: Clear padding in PgStat_HashKey keys |