From mboxrd@z Thu Jan 1 00:00:00 1970 From: Denis Zaitsev Subject: strcmp is too heavy for its everyday usage... Date: Thu, 8 Jan 2004 06:09:24 +0500 Sender: libc-alpha-owner@sources.redhat.com Message-ID: <20040108060924.A4431@zzz.ward.six> Mime-Version: 1.0 Return-path: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Content-Disposition: inline List-Id: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Zack Weinberg , Andreas Jaeger , Richard Henderson Cc: libc-alpha@sources.redhat.com, linux-gcc@vger.kernel.org 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?