Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Aug 2010 11:29:50 -0500
From:      Alan Cox <alan.l.cox@gmail.com>
To:        Dimitry Andric <dimitry@andric.com>
Cc:        Doug Barton <dougb@freebsd.org>, Justin Hibbits <chmeeedalf@gmail.com>, core@freebsd.org, delphij@freebsd.org, Gabor Kovesdan <gabor@freebsd.org>, Steve Kargl <sgk@troutmask.apl.washington.edu>, =?ISO-8859-1?Q?Dag=2DErling_Sm=F8rgrav?= <des@des.no>, current@freebsd.org
Subject:   Re: Official request: Please make GNU grep the default
Message-ID:  <AANLkTik-ee6iKiOoA=KMmmToS2giUOmW5JB-d1vBx9r3@mail.gmail.com>
In-Reply-To: <4C6AAA88.5080606@andric.com>
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> <B7A05068-9578-4341-851B-86BD9BC7A2DA@gmail.com> <8639ufd78w.fsf@ds4.des.no> <4C6844D8.5070602@andric.com> <86sk2faqdl.fsf@ds4.des.no> <4C6AAA88.5080606@andric.com>

next in thread | previous in thread | raw e-mail | index | archive | help
2010/8/17 Dimitry Andric <dimitry@andric.com>

> On 2010-08-16 10:55, Dag-Erling Sm=F8rgrav wrote:
> > Dimitry Andric <dimitry@andric.com> 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 i=
f
> > that fails, fall back to the plain buffered read(2) method.
>
> 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.
>
>

Try it again on a memory resident file with the MAP_PREFAULT_READ option
that is provided by this patch:

http://www.cs.rice.edu/~alc/MAP_PREFAULT_READ.patch

Regards,
Alan



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTik-ee6iKiOoA=KMmmToS2giUOmW5JB-d1vBx9r3>