On Wed, Nov 13, 2024 at 07:50:50AM +0000, Bertrand Drouvot wrote: > I did a quick check with clang and it looks like it is not as smart as gcc > for the non inline case.
Not as much, still smart enough to skip the > 64B part when dealing
with a structure that does not require it. So it's actually still
good considering where we are at now on HEAD for the 8kB all-zero page
case.
> Anyway it's not like we have the choice: we need (at least) one len check for
> safety reason (to not crash or read invalid data).
>
> So, I'd vote for pg_memory_is_all_zeros_v12() then, thoughts?
Makes sense to me to just do that, with a first < 8 loop, and a second
for the 8~63 range. And I can understand the code I read here as it
self-documents what it does.
* There is no risk to read beyond the memory area thanks to the len < 64
* check done below.
This comment should do a s/below/above/ and a s/check/checks/, as it
refers to the two checks done before the trick with the 64B-per-loop
check.
There is also a "cant'" in the last size_t check. Simple typo.
--
Michael
signature.asc
Description: PGP signature
