From owner-freebsd-hackers@FreeBSD.ORG Sun Jun 2 10:41:28 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 08C9D119 for ; Sun, 2 Jun 2013 10:41:28 +0000 (UTC) (envelope-from emorrasg@yahoo.es) Received: from nm6.bullet.mail.ird.yahoo.com (nm6.bullet.mail.ird.yahoo.com [77.238.189.63]) by mx1.freebsd.org (Postfix) with SMTP id 3D87B1E5B for ; Sun, 2 Jun 2013 10:41:26 +0000 (UTC) Received: from [77.238.189.48] by nm6.bullet.mail.ird.yahoo.com with NNFMP; 02 Jun 2013 10:41:25 -0000 Received: from [46.228.39.117] by tm1.bullet.mail.ird.yahoo.com with NNFMP; 02 Jun 2013 10:41:25 -0000 Received: from [127.0.0.1] by smtp154.mail.ir2.yahoo.com with NNFMP; 02 Jun 2013 10:41:25 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s1024; t=1370169685; bh=tieHtNz1+k8PrMcwO9aLVKk1c9NXmHmX0gJm7xYQjFc=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:X-Rocket-Received:Date:From:To:Subject:Message-Id:In-Reply-To:References:X-Mailer:Disposition-Notification-To:Mime-Version:Content-Type:Content-Transfer-Encoding; b=htQiYPAV1KvHnLKIvU61pXZYFdYZPitFRF8yKQPLZPajQynwDiCIPJ6MUZjdJ9vqkC+DxTxKAPQGu4gXgkgqUb2UuT9WPPZayrFbvDq/ePtG373O5Q0nAr0kYwqiOAAKeAuW1WFGLJLZYXTQq3bsb66ZzVls+vuMcRUCE20E7gM= X-Yahoo-Newman-Id: 563703.84176.bm@smtp154.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: 7gx9KSEVM1lopDWRzBsq2UyQmjS1bK_55u4mGmVCa1AwnV5 uRuiN3zp03lvV_e_wcUYVO6qo31Cy82iXA.kCxhWtR512LMUmtAMyDJcu25a COMkjFsYNHXHyt5w6F.y5wrXjsggnQWeehav82_WihL6b4S_50OBfJMpQ85c nejnMwzPsYMXAlYY4MomppMx86Gzs0aeUJEqAL5eShqYLZEEZ.iTDH_rQn.N xGnb_81Os8QBcR47FUKFHpqGk5pSkOBbX7TWZO97Gcn7Iep9Qp7e9yjsvKWb _Jlds0dNU3DsKiscFoBB8Nny2Yj6VczNOzTH4lvSRZdewr_HsFoGy8A8kx2z v53bWF6Cbl8GnzjJcTwY03MIyYox.6WPOJprRu8GOzr_ff32Nu19yfaU0.RE TrLh0Jq9BKJUyxsHdKJTpbL4MrGmPh8jeK3KRp_Lx_FGQv4hYZu7cmXUBEXU - X-Yahoo-SMTP: mX392iiswBAeJNdO_s.EW62LZDJR X-Rocket-Received: from camibar.emorras.eu (emorrasg@89.7.216.154 with ) by smtp154.mail.ir2.yahoo.com with SMTP; 02 Jun 2013 10:41:25 +0000 UTC Date: Sun, 2 Jun 2013 12:41:27 +0200 From: Eduardo Morras To: freebsd-hackers@freebsd.org Subject: Re: sed query Message-Id: <20130602124127.6c3a847ea5ddb116a69d4814@yahoo.es> In-Reply-To: References: X-Mailer: Sylpheed 3.3.0 (GTK+ 2.24.18; amd64-portbld-freebsd9.1) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 10:41:28 -0000 On Fri, 31 May 2013 15:01:59 +0100 Chris Rees wrote: > Hi all, > > I think I've discovered a strange behaviour of sed perhaps triggered > by the length of a regex passed to it. I noticed that a certain > expression I passed took a very long time, and suspected the usual > backtracking loop, so I started trimming it... and discovered this: > > [crees@pegasus]~% time sed -ne "s,^BitchX-[0-9][^|]*[\|]/usr/por,," > /var/db/pkg/INDEX-9 > 4.699u 0.007s 0:04.70 99.7% 40+2733k 0+0io 0pf+0w > [crees@pegasus]~% time sed -ne "s,^BitchX-[0-9][^|]*[\|]/usr/po,," > /var/db/pkg/INDEX-9 > 0.042u 0.000s 0:00.04 100.0% 48+3216k 0+0io 0pf+0w > > I've looked at the code, and can't from a brief glance figure out why > a slightly longer regex makes such a difference-- does it start to > split it? Perhaps second one uses memory cache data? Run both twice and show us the second times. > Chris > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" --- --- Eduardo Morras