Re: define pg_structiszero(addr, s, r)
David Rowley <dgrowleyml@gmail.com>
From: David Rowley <dgrowleyml@gmail.com>
To: Peter Eisentraut <peter@eisentraut.org>
Cc: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>,
Ranier Vilela <ranier.vf@gmail.com>, Michael Paquier <michael@paquier.xyz>, Peter Smith <smithpb2250@gmail.com>, Heikki Linnakangas <hlinnaka@iki.fi>, pgsql-hackers@lists.postgresql.org
Date: 2024-11-06T19:05:10Z
Lists: pgsql-hackers
On Thu, 7 Nov 2024 at 07:34, Peter Eisentraut <peter@eisentraut.org> wrote: > Speaking of which, couldn't you just use > > pg_popcount(ptr, len) == 0 That might be quite good for small lengths or for use cases where the memory is always or almost always zero. The problem is there's no early exit when you find the first non-zero which means, for larger lengths, reading much more memory. That'll both take longer and possibly evict cache lines which might be useful to have in the near future. David
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