This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/19920] RFE: test whether a block of memory is all 0
- From: "eblake at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Thu, 08 Sep 2016 14:56:24 +0000
- Subject: [Bug libc/19920] RFE: test whether a block of memory is all 0
- Auto-submitted: auto-generated
- References: <bug-19920-131@http.sourceware.org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=19920
--- Comment #2 from Eric Blake <eblake at redhat dot com> ---
Without using any processor-specific optimizations,
http://stackoverflow.com/questions/1493936/faster-approach-to-checking-for-an-all-zero-buffer-in-c
has some ideas for optimizations, including one that has a useful performance
ramification: Once you have taken care of any unaligned head and tail, if you
can check that the first aligned cache line is 0, you can then do memcmp(start,
start+cache_line_len, buf_len-cache_line_len) to get the machine-specific
speedups built into memcmp.
But yes, a dedicated interface that directly uses machine-specific tricks where
possible will be faster, and seems useful to have.
--
You are receiving this mail because:
You are on the CC list for the bug.