On Thu, 7 Nov 2024 at 07:34, Peter Eisentraut <pe...@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