From owner-cvs-src@FreeBSD.ORG Sun Apr 3 06:55:57 2005 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BA04016A4CE; Sun, 3 Apr 2005 06:55:57 +0000 (GMT) Received: from mailout1.pacific.net.au (mailout1.pacific.net.au [61.8.0.84]) by mx1.FreeBSD.org (Postfix) with ESMTP id 23FDD43D41; Sun, 3 Apr 2005 06:55:57 +0000 (GMT) (envelope-from bde@zeta.org.au) Received: from mailproxy2.pacific.net.au (mailproxy2.pacific.net.au [61.8.0.87])j336ttA6005164; Sun, 3 Apr 2005 16:55:55 +1000 Received: from katana.zip.com.au (katana.zip.com.au [61.8.7.246]) j336trMq023434; Sun, 3 Apr 2005 16:55:54 +1000 Date: Sun, 3 Apr 2005 16:55:53 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: David Schultz In-Reply-To: <20050402185706.GA19208@VARK.MIT.EDU> Message-ID: <20050403162709.Q30325@delplex.bde.org> References: <200504021852.j32IqjhR031587@repoman.freebsd.org> <20050402185706.GA19208@VARK.MIT.EDU> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed cc: cvs-src@FreeBSD.org cc: src-committers@FreeBSD.org cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/lib/libc/string strcspn.c strspn.csrc/sys/libkern strspn.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Apr 2005 06:55:58 -0000 On Sat, 2 Apr 2005, David Schultz wrote: > BTW, anyone know a good reason why we have optimized string > functions (e.g. strcmp(), strcpy()) in libc, but not in libkern? It is because str* functions are almost never used in the kernel. E.g., to a first approximation, strcmp() is only used for initialization. Even the non-string function for copying pathnames from user space (copyinstr()) rarely shows up in profiles. Standard C string functions are a few orders of magnitude less important than this. > In testing strcmp(s, s), I found that the libc version on i386 is > 11% faster when s has length 1 and 4% faster when s has length 400. That's surprisingly little for an "optimized" asm version versus an unoptimized C version. > The kernel has many consumers of these functions, but maybe their > performance is irrelevant in the grand scheme of things. > Certainly things like bcopy and bswap are more important... Except bswap() isn't important. It isn't even used in 4.4BSD-Lite2. BTW, amd64 doesn't have any "optimized" string functions in userland, though the "optimization" would actually be an optimization for things like bcopy() at least. Bruce