From owner-freebsd-current@FreeBSD.ORG Wed Mar 30 08:35:04 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 2130B16A4CE for ; Wed, 30 Mar 2005 08:35:04 +0000 (GMT) Received: from postfix3-1.free.fr (postfix3-1.free.fr [213.228.0.44]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8F6C543D1F for ; Wed, 30 Mar 2005 08:35:03 +0000 (GMT) (envelope-from tataz@tataz.chchile.org) Received: from tatooine.tataz.chchile.org (vol75-8-82-233-239-98.fbx.proxad.net [82.233.239.98]) by postfix3-1.free.fr (Postfix) with ESMTP id C6952173512 for ; Wed, 30 Mar 2005 10:35:02 +0200 (CEST) Received: by tatooine.tataz.chchile.org (Postfix, from userid 1000) id A7372407C; Wed, 30 Mar 2005 10:34:36 +0200 (CEST) Date: Wed, 30 Mar 2005 10:34:35 +0200 From: Jeremie Le Hen To: freebsd-current@FreeBSD.org Message-ID: <20050330083435.GI75546@obiwan.tataz.chchile.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.8i Subject: 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 08:35:04 -0000 Hi list, 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. 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 ? 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 ? The temporary patch is here [2], I didn't have time to try it yet, this is why it is not attached with this email. Best regards, [1] http://www.dragonflybsd.org/cvsweb/src/lib/libc/string/strcspn.c [2] http://jeremie.le-hen.org/~tataz/patches/FreeBSD/libc.strcspn.dfbsd.patch -- Jeremie Le Hen < jeremie at le-hen dot org >< ttz at chchile dot org >