From owner-freebsd-current@FreeBSD.ORG Thu Mar 31 11:26:01 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 165F716A4CE for ; Thu, 31 Mar 2005 11:26:01 +0000 (GMT) Received: from mail01.syd.optusnet.com.au (mail01.syd.optusnet.com.au [211.29.132.182]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4144743D5A for ; Thu, 31 Mar 2005 11:26:00 +0000 (GMT) (envelope-from PeterJeremy@optushome.com.au) Received: from cirb503493.alcatel.com.au (c211-30-75-229.belrs2.nsw.optusnet.com.au [211.30.75.229]) j2VBPrsO001153 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Thu, 31 Mar 2005 21:25:57 +1000 Received: from cirb503493.alcatel.com.au (localhost.alcatel.com.au [127.0.0.1])j2VBPq7l075979; Thu, 31 Mar 2005 21:25:53 +1000 (EST) (envelope-from pjeremy@cirb503493.alcatel.com.au) Received: (from pjeremy@localhost)j2VBPngQ075978; Thu, 31 Mar 2005 21:25:49 +1000 (EST) (envelope-from pjeremy) Date: Thu, 31 Mar 2005 21:25:49 +1000 From: Peter Jeremy To: Brooks Davis Message-ID: <20050331112549.GI71384@cirb503493.alcatel.com.au> References: <20050330083435.GI75546@obiwan.tataz.chchile.org> <20050330110613.GB71384@cirb503493.alcatel.com.au> <20050330183145.GB24465@odin.ac.hmc.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050330183145.GB24465@odin.ac.hmc.edu> User-Agent: Mutt/1.4.2i 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 List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Mar 2005 11:26:01 -0000 On Wed, 2005-Mar-30 10:31:45 -0800, Brooks Davis 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. I was thinking about this last night. The easy way is to generate random "string" and "charset" arrays of varying length and time both strcspn() variants - this gives you two two-dimensional surfaces showing timing vs argument size. The difficulty is visualising the result and deciding whether pairs of random strings are realistic. -- Peter Jeremy