This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
strcmp is too heavy for its everyday usage...
- From: Denis Zaitsev <zzz at anda dot ru>
- To: Zack Weinberg <zack at codesourcery dot com>, Andreas Jaeger <aj at suse dot de>,Richard Henderson <rth at redhat dot com>
- Cc: libc-alpha at sources dot redhat dot com, linux-gcc at vger dot kernel dot org
- Date: Thu, 8 Jan 2004 06:09:24 +0500
- Subject: strcmp is too heavy for its everyday usage...
strcmp is _mostly_ used here and there to check strings for equality
only, not for finding their ordering. And if we have a function for
this equality check only, it would be a reasonable benefit:
a) for a long strings this function can operate with a whole
words vs. bytes, which is much faster;
b) for a very short strings, when strcmp and this function can be
unrolled into a series of a direct bytes comparing, this defun
don't have to cope with (unsigned char) -> (int) casting for the
each pair of bytes, so it will be shorter, faster etc.
memcmp is the subject of the question, too.
Any comments?