This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/19920] RFE: test whether a block of memory is all 0


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]