[PATCH v2] x86-64: Optimize bzero

Wilco Dijkstra Wilco.Dijkstra@arm.com
Thu Feb 10 19:19:51 GMT 2022


Hi Alex,

Don't worry, you're not a bzero user - just check your binaries and
I bet you will find zero calls to bzero!

GCC/LLVM avoid calls to bzero, bcmp, bcopy and mempcpy. The goal is to
avoid unnecessary proliferation of almost identical string functions where
there is absolutely no performance benefit. In fact this duplication is typically
a net loss, partly due to reducing optimization effort and the extra runtime
overhead due to having multiple copies of the same function in caches and
predictors.

However if you care about having a standardized call to zero memory, just
propose it for the next C/C++ standard. Given we will not agree on naming,
we could just add memzero, memclr, memset_zero and bcopy as synonyms
for memset.

Cheers,
Wilco


More information about the Libc-alpha mailing list