From owner-freebsd-current@FreeBSD.ORG Fri Aug 13 15:41:37 2010 Return-Path: Delivered-To: current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 596B6106566C; Fri, 13 Aug 2010 15:41:37 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from mail.farley.org (mail.farley.org [IPv6:2001:470:1f0f:20:2::11]) by mx1.freebsd.org (Postfix) with ESMTP id CBBA88FC14; Fri, 13 Aug 2010 15:41:36 +0000 (UTC) Received: from thor.farley.org (HPooka@thor.farley.org [IPv6:2001:470:1f0f:20:1::5]) by mail.farley.org (8.14.4/8.14.4) with ESMTP id o7DFfZIC020817; Fri, 13 Aug 2010 10:41:35 -0500 (CDT) (envelope-from scf@FreeBSD.org) Date: Fri, 13 Aug 2010 10:41:35 -0500 (CDT) From: "Sean C. Farley" To: Gabor Kovesdan In-Reply-To: <4C650B75.3020800@FreeBSD.org> Message-ID: References: <4C6505A4.9060203@FreeBSD.org> <4C650B75.3020800@FreeBSD.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="56599777-398594934-1281714095=:35204" X-Spam-Status: No, score=-1.3 required=4.0 tests=AWL,BAYES_00,SPF_SOFTFAIL autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.farley.org Cc: current@FreeBSD.org Subject: Re: Official request: Please make GNU grep the default X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 13 Aug 2010 15:41:37 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --56599777-398594934-1281714095=:35204 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed On Fri, 13 Aug 2010, Gabor Kovesdan wrote: > Em 2010.08.13. 10:43, Doug Barton escreveu: >> My reason is simple, performance. While doing some portmaster work >> recently I was regression testing some changes I made to the --index* >> options and noticed that things were dramatically slower than the >> last time I tested those features. Thinking that I had made a >> programming mistake I dug into my code, and while the regexps that I >> was using could be tuned for slightly better performance the problem >> was not in my code. I then installed textproc/gnugrep to compare, >> and the differences were very dramatic using a highly pessimized test >> case (finding a match on the last line of INDEX). The script I used >> to test is at http://people.freebsd.org/~dougb/grep-time-trial.sh.txt >> and a typical result was: >> >> GNU grep >> Elapsed time: 2 seconds >> >> BSD grep >> Elapsed time: 47 seconds >> > Ok, I'll take care of this soon, and make GNU grep default, again with > a knob to build BSD grep. I agree with you that we cannot allow such a > big performance drawback but I my measures only showed significant > differences for very big searches and I didn't imagine that it could > add up to such a big diference. I'm sorry for the bad decision I took > making it default. This should trim some time off BSD grep. It removes the lock/unlock for each fgetc() by locking/unlocking the file once. stdio can be slow. You probably want to replace flockfile() with ftrylockfile() if threads will be involved at some point (threading or making a libgrep that may be used in a threaded process). Sean -- scf@FreeBSD.org --56599777-398594934-1281714095=:35204 Content-Type: TEXT/PLAIN; charset=US-ASCII; name=grep.patch Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Content-Disposition: attachment; filename=grep.patch SW5kZXg6IGZpbGUuYw0KPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQ0KLS0tIGZp bGUuYwkocmV2aXNpb24gMjEwODYyKQ0KKysrIGZpbGUuYwkod29ya2luZyBj b3B5KQ0KQEAgLTc0LDcgKzc0LDcgQEANCiANCiAJc3dpdGNoIChmaWxlYmVo YXZlKSB7DQogCWNhc2UgRklMRV9TVERJTzoNCi0JCXJldHVybiAoZmdldGMo Zi0+ZikpOw0KKwkJcmV0dXJuIChnZXRjX3VubG9ja2VkKGYtPmYpKTsNCiAJ Y2FzZSBGSUxFX0daSVA6DQogCQlyZXR1cm4gKGd6Z2V0YyhmLT5nemYpKTsN CiAJY2FzZSBGSUxFX0JaSVA6DQpAQCAtMTg5LDYgKzE4OSw3IEBADQogCWYg PSBncmVwX21hbGxvYyhzaXplb2YgKmYpOw0KIA0KIAlpZiAoKGYtPmYgPSBm ZG9wZW4oU1RESU5fRklMRU5PLCAiciIpKSAhPSBOVUxMKSB7DQorCQlmbG9j a2ZpbGUoZi0+Zik7DQogCQlmLT5zdGRpbiA9IHRydWU7DQogCQlyZXR1cm4g KGYpOw0KIAl9DQpAQCAtMjM4LDYgKzIzOSw3IEBADQogDQogCXN3aXRjaCAo ZmlsZWJlaGF2ZSkgew0KIAljYXNlIEZJTEVfU1RESU86DQorCQlmdW5sb2Nr ZmlsZShmLT5mKTsNCiAJCWZjbG9zZShmLT5mKTsNCiAJCWJyZWFrOw0KIAlj YXNlIEZJTEVfR1pJUDoNCg== --56599777-398594934-1281714095=:35204--