From owner-freebsd-current@FreeBSD.ORG Wed Mar 30 11:06:20 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 A03C716A4CE for ; Wed, 30 Mar 2005 11:06:20 +0000 (GMT) Received: from mail22.syd.optusnet.com.au (mail22.syd.optusnet.com.au [211.29.133.160]) by mx1.FreeBSD.org (Postfix) with ESMTP id BE9FC43D2D for ; Wed, 30 Mar 2005 11:06:19 +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]) j2UB6F9V010297 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Wed, 30 Mar 2005 21:06:17 +1000 Received: from cirb503493.alcatel.com.au (localhost.alcatel.com.au [127.0.0.1])j2UB6E7l074333; Wed, 30 Mar 2005 21:06:15 +1000 (EST) (envelope-from pjeremy@cirb503493.alcatel.com.au) Received: (from pjeremy@localhost)j2UB6EwL074332; Wed, 30 Mar 2005 21:06:14 +1000 (EST) (envelope-from pjeremy) Date: Wed, 30 Mar 2005 21:06:13 +1000 From: Peter Jeremy To: Jeremie Le Hen Message-ID: <20050330110613.GB71384@cirb503493.alcatel.com.au> References: <20050330083435.GI75546@obiwan.tataz.chchile.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050330083435.GI75546@obiwan.tataz.chchile.org> User-Agent: Mutt/1.4.2i cc: freebsd-current@freebsd.org 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: Wed, 30 Mar 2005 11:06:20 -0000 On Wed, 2005-Mar-30 10:34:35 +0200, Jeremie Le Hen wrote: >Andreas Hauser made a patch to strcspn(3) for the DragonFly project >which makes it faster when dealing with long strings [1] (rev 1.4). >It basically changes the complexity of the function from > O(strlen(str) * strlen(chars)) >to > O(strlen(str) + strlen(chars)) >by using a charset. It has a significantly higher overhead due to the need to zero the charset. >I have two questions. First, is this change worth enough to be merged >in FreeBSD (this function is currently used in 42 binaries from >/{,usr/}{s,}bin) ? I mean does the performance gain on large strings >compensates the use of a large 256-bytes buffer ? You are proposing this change so I think it's up to you to demonstrate an improvement. I don't think the space is an issue in userland (it would be in the kernel) so it's just a matter of which is faster. Did Joerg or Andreas provide any performance test results? My gut feeling is that strcspn() isn't heavily used enough or with long enough "chars" arguments for the change to be noticable in the base system. >Second, I would like to know how to deal with the copyright update. >ATM, I changed the top of the copyright (up to Andrea's email address), >is it acceptable ? My reading of the change is that it completely replaces strcspn.c and therefore the change should include Andrea's copyright, replacing the existing UC copyright. -- Peter Jeremy