From owner-freebsd-current@FreeBSD.ORG Wed Apr 6 04:33:40 2005 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9B85516A4CE for ; Wed, 6 Apr 2005 04:33:40 +0000 (GMT) Received: from smtp816.mail.sc5.yahoo.com (smtp816.mail.sc5.yahoo.com [66.163.170.2]) by mx1.FreeBSD.org (Postfix) with SMTP id 4B82643D46 for ; Wed, 6 Apr 2005 04:33:40 +0000 (GMT) (envelope-from noackjr@alumni.rice.edu) Received: from unknown (HELO optimator.noacks.org) (noacks@swbell.net@70.240.251.38 with login) by smtp816.mail.sc5.yahoo.com with SMTP; 6 Apr 2005 04:33:39 -0000 Received: from localhost (localhost [127.0.0.1]) by optimator.noacks.org (Postfix) with ESMTP id 5F3DA612C; Tue, 5 Apr 2005 23:33:38 -0500 (CDT) Received: from optimator.noacks.org ([127.0.0.1]) by localhost (optimator.noacks.org [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 00627-06; Tue, 5 Apr 2005 23:33:35 -0500 (CDT) Received: from compgeek.noacks.org (compgeek [192.168.1.10]) by optimator.noacks.org (Postfix) with ESMTP id C51D960CE; Tue, 5 Apr 2005 23:33:35 -0500 (CDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) by compgeek.noacks.org (8.13.3/8.13.3) with ESMTP id j364XUhI039101; Tue, 5 Apr 2005 23:33:30 -0500 (CDT) (envelope-from noackjr@alumni.rice.edu) Message-ID: <4253669A.1060704@alumni.rice.edu> Date: Tue, 05 Apr 2005 23:33:30 -0500 From: Jon Noack User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050326) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Matthew Dillon References: <20050330083435.GI75546@obiwan.tataz.chchile.org> <20050330183145.GB24465@odin.ac.hmc.edu> <200504060346.j363ko4b088610@apollo.backplane.com> In-Reply-To: <200504060346.j363ko4b088610@apollo.backplane.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at noacks.org cc: Peter Jeremy cc: freebsd-current@freebsd.org cc: Jeremie Le Hen Subject: Re: strcspn(3) complexity improvement X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: noackjr@alumni.rice.edu List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2005 04:33:40 -0000 On 04/05/05 22:46, Matthew Dillon wrote: > :The real question I have is, how long does the string need to be before > :this is a win and how much does it hurt for typical string lengths? > :I've written code with strcspn that needed to perform well, but it was > :parsing 80-column punch card derived formats. > : > :-- Brooks > > I think the answer is to not use strcspn() in cases where it *really* > matters. > > I don't think what's in DFly is the right solution either. A bitmap > would be a good compromise, though... that would only require clearing > 32 bytes (vs 256) at the cost of slowing down the loop a little. The version das@ committed used one bit per element: http://lists.freebsd.org/pipermail/cvs-src/2005-April/044040.html Jon