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 <mich...@paquier.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


Reply via email to