[PATCH] Use "all_zero()"

Douglas Bagnall douglas.bagnall at catalyst.net.nz
Wed Jan 4 22:18:51 UTC 2017


On 05/01/17 08:17, Volker Lendecke wrote:

> If the compiler does not detect the pattern and fails to optimize it,
> I think a path forward would be to read uint64_t's and the rest as
> bytes. 

Yes. A comparable pattern in glibc is memset() which steps to the
alignment boundary in bytes, jumps into bigger units for a while, then
finishes in bytes.

In any case, in my tests (without your patches) I see 0.1% of our time
spent in memcmp() and nothing in all_zero(). Of course the cost of these
particular memcmps will appear elsewhere where the cache got clobbered,
and many instances are likely to have been inlined so don't show up.

cheers,
Douglas



More information about the samba-technical mailing list