From owner-freebsd-alpha Sun Dec 29 12:27:54 2002 Delivered-To: freebsd-alpha@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 48A5837B401 for ; Sun, 29 Dec 2002 12:27:53 -0800 (PST) Received: from alcanet.com.au (mail2.alcanet.com.au [203.62.196.17]) by mx1.FreeBSD.org (Postfix) with ESMTP id B664A43ED4 for ; Sun, 29 Dec 2002 12:27:51 -0800 (PST) (envelope-from peter.jeremy@alcatel.com.au) Received: from sydsmtp01.alcatel.com.au (IDENT:root@localhost.localdomain [127.0.0.1]) by alcanet.com.au (8.12.4/8.12.4/Alcanet1.3) with ESMTP id gBTKRUY1030770; Mon, 30 Dec 2002 07:27:31 +1100 Received: from gsmx07.alcatel.com.au ([139.188.20.247]) by sydsmtp01.alcatel.com.au (Lotus Domino Release 5.0.11) with ESMTP id 2002123007272906:67271 ; Mon, 30 Dec 2002 07:27:29 +1100 Received: from gsmx07.alcatel.com.au (localhost [127.0.0.1]) by gsmx07.alcatel.com.au (8.12.5/8.12.5) with ESMTP id gBTKRSQ8030304; Mon, 30 Dec 2002 07:27:28 +1100 (EST) (envelope-from peter.jeremy@alcatel.com.au) Received: (from jeremyp@localhost) by gsmx07.alcatel.com.au (8.12.5/8.12.5/Submit) id gBTKRJkg030303; Mon, 30 Dec 2002 07:27:19 +1100 (EST) (envelope-from peter.jeremy@alcatel.com.au) Date: Mon, 30 Dec 2002 07:27:19 +1100 From: Peter Jeremy To: Anders Gavare Cc: freebsd-alpha@FreeBSD.ORG Subject: Re: faster strlen() using longs (?) Message-ID: <20021229202719.GC17648@gsmx07.alcatel.com.au> Mail-Followup-To: Anders Gavare , freebsd-alpha@FreeBSD.ORG References: Mime-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.4i X-MIMETrack: Itemize by SMTP Server on SYDSMTP01/AlcatelAustralia(Release 5.0.11 |July 24, 2002) at 30/12/2002 07:27:29 AM, Serialize by Router on SYDSMTP01/AlcatelAustralia(Release 5.0.11 |July 24, 2002) at 30/12/2002 07:27:31 AM, Serialize complete at 30/12/2002 07:27:31 AM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Sender: owner-freebsd-alpha@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On 2002-Dec-29 00:25:49 +0100, Anders Gavare wrote: >I'm using FreeBSD 4.5 on an Alpha, and I noticed that strlen() isn't >implemented using words, but using chars. This is true of all the strXXX() functions. The original AXP white papers include suggestions for efficiently implementing string functions in the absence of byte operations. Based on those suggestions, I implemented bcmp(3) using longs (see /usr/src/sys/libkern/bcmp.c) - and found that it was faster on x86 as well. >I've experimented with several different variations of using longs, and >this is the fastest one I've come up with. ... > It is 2.8 times faster than the default strlen() in libc. On what sort of CPU? With what length strings? What compiler options? Have you tried it on a range of different Alpha CPUs? Peter To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-alpha" in the body of the message