strcmp is too heavy for its everyday usage...

Denis Zaitsev zzz@anda.ru
Thu Jan 8 01:09:00 GMT 2004


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?



More information about the Libc-alpha mailing list