Re: define pg_structiszero(addr, s, r)
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Cc: David Rowley <dgrowleyml@gmail.com>, Ranier Vilela <ranier.vf@gmail.com>, Peter Smith <smithpb2250@gmail.com>, Peter Eisentraut <peter@eisentraut.org>, Heikki Linnakangas <hlinnaka@iki.fi>, pgsql-hackers@lists.postgresql.org
Date: 2024-11-08T05:34:34Z
Lists: pgsql-hackers
Attachments
- v9-0001-Optimize-pg_memory_is_all_zeros.patch (text/x-diff) patch v9-0001
On Thu, Nov 07, 2024 at 08:41:34AM +0000, Bertrand Drouvot wrote: > Yeah, fully agree. My initial testing was not "good" enough and so was not showing > as much improvement as your's and David's ones. > > Please find v8 attached. I've tested that with a couple of structures in an independent module and that seems to do the job. The patch should be split into two parts for clarity: one to switch pg_memory_is_all_zeros to use the optimized version and a second to change PageIsVerifiedExtended(). Not a big deal as the code paths are entirely independent, that's just my view of the matter. I've done a round of comment and term cleanup for the whole patch, while on it. Btw, gcc seems a bit smarter than clang when it comes to optimizing the code depending on the size of the structures. gcc gives up on SIMD if it's sure that the structure on which we are going to use the allzero check won't need it at all, and clang keeps it even if it does not need it. That was interesting to see, while going through the review.. -- Michael
Commits
-
Use pg_memory_is_all_zeros() in PageIsVerifiedExtended()
- 03a42c9652f8 18.0 landed
-
Optimize pg_memory_is_all_zeros() in memutils.h
- 5be1dabd2ae0 18.0 landed
-
Remove use of pg_memory_is_all_zeros() in bufpage.c
- e819bbb7c82a 18.0 landed
-
Add pg_memory_is_all_zeros() in memutils.h
- 07e9e28b56db 18.0 landed