From owner-freebsd-current@FreeBSD.ORG Mon Aug 16 19:18:43 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 66E141065670; Mon, 16 Aug 2010 19:18:43 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from server.mypc.hu (server.mypc.hu [87.229.73.95]) by mx1.freebsd.org (Postfix) with ESMTP id DE5288FC08; Mon, 16 Aug 2010 19:18:42 +0000 (UTC) Received: from server.mypc.hu (localhost [127.0.0.1]) by server.mypc.hu (Postfix) with ESMTP id F36B714DC69D; Mon, 16 Aug 2010 21:18:41 +0200 (CEST) X-Virus-Scanned: amavisd-new at server.mypc.hu Received: from server.mypc.hu ([127.0.0.1]) by server.mypc.hu (server.mypc.hu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id kVdx2aq1Pz7P; Mon, 16 Aug 2010 21:18:39 +0200 (CEST) Received: from [192.168.1.105] (catv-80-99-92-167.catv.broadband.hu [80.99.92.167]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by server.mypc.hu (Postfix) with ESMTPSA id B080A14DC64C; Mon, 16 Aug 2010 21:18:39 +0200 (CEST) Message-ID: <4C698F0E.5080408@FreeBSD.org> Date: Mon, 16 Aug 2010 21:18:38 +0200 From: Gabor Kovesdan User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pt-PT; rv:1.9.1.11) Gecko/20100711 Thunderbird/3.0.6 MIME-Version: 1.0 To: Dimitry Andric References: <4C6505A4.9060203@FreeBSD.org> <20100813085235.GA16268@freebsd.org> <4C66C010.3040308@FreeBSD.org> <4C673F02.8000805@FreeBSD.org> <20100815013438.GA8958@troutmask.apl.washington.edu> <4C67492C.5020206@FreeBSD.org> <8639ufd78w.fsf@ds4.des.no> <4C6844D8.5070602@andric.com> In-Reply-To: <4C6844D8.5070602@andric.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Doug Barton , Justin Hibbits , core@freebsd.org, delphij@freebsd.org, Steve Kargl , =?UTF-8?B?RGFnLUVybGluZyBTbcO4cmdyYXY=?= , 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: Mon, 16 Aug 2010 19:18:43 -0000 Em 2010.08.15. 21:49, Dimitry Andric escreveu: > GNU grep > Elapsed time: 57 seconds > > BSD grep (original) > Elapsed time: 820 seconds (~14.4x slower than GNU grep) > > BSD grep (quickfixed) > Elapsed time: 115 seconds (~2.0x slower than GNU grep) > > It proves that getting rid of the fgetc's is certainly worthwhile, and I > have attached a more complete patch that: > > - Replaces the horrendously inefficient grep_fgetln() with mostly the > same implementation as the libc fgetln() function. > - Uses plain file descriptors instead of struct FILE, since the > buffering is done manually anyway, and it makes it easier to support > gzip and bzip2. > - Let the bzip2 reader just read the file as plain data, when the > initial magic number doesn't match, mimicking the behaviour of GNU > grep. > > There is probably more room for optimization, but let's see if this > survives a bunch of tests first. :) > Thanks Dmitry, I've also started to work on a similar solution but you were extremely fast. :) I'm checking your patch just now and will tell my experiences if I see any regression. Gabor