From owner-freebsd-current@FreeBSD.ORG Tue Aug 17 15:47:14 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 3B45110656A8 for ; Tue, 17 Aug 2010 15:47:14 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 8BA118FC23 for ; Tue, 17 Aug 2010 15:47:13 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o7HFjbj5033915 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 17 Aug 2010 18:45:37 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id o7HFjb5i006131; Tue, 17 Aug 2010 18:45:37 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o7HFjbd9006130; Tue, 17 Aug 2010 18:45:37 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 17 Aug 2010 18:45:37 +0300 From: Kostik Belousov To: Dimitry Andric Message-ID: <20100817154537.GM2396@deviant.kiev.zoral.com.ua> References: <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> <86sk2faqdl.fsf@ds4.des.no> <4C6AAA88.5080606@andric.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="XrEgl6YxVIw5fRRT" Content-Disposition: inline In-Reply-To: <4C6AAA88.5080606@andric.com> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-2.2 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_50, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua 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: Tue, 17 Aug 2010 15:47:14 -0000 --XrEgl6YxVIw5fRRT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable [Cc: list sanitized] On Tue, Aug 17, 2010 at 05:28:08PM +0200, Dimitry Andric wrote: > On 2010-08-16 10:55, Dag-Erling Sm??rgrav wrote: > > Dimitry Andric writes: > >> - 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. > > It might be worth a shot adding mmap(2) support as well, i.e. when > > processing an uncompressed regular file, try to mmap(2) it first, and if > > that fails, fall back to the plain buffered read(2) method. >=20 > I added a simple mmap to grep, and time-trialed it, but the mmap version > was somewhat slower than the regular version. I understood from Kostik > Belousov that readahead does not work properly with mmap, and it should > not be used for "one-time" reads. This is not exactly what I said. I argue that read-ahead implemented by vm_faul() is much less efficient that buffer clustering. Also, the cost of setting user mapping for the one time read is also non-trivial. The conclusion is right, it is better to use read(2) for one-time read. --XrEgl6YxVIw5fRRT Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkxqrqEACgkQC3+MBN1Mb4ieBQCgr3hLFBU2p68taZr5szZ9Rwv2 dc8An0j/aPqtFF2W0OGHmlYCF2YeRp9g =8N0A -----END PGP SIGNATURE----- --XrEgl6YxVIw5fRRT--