Official request: Please make GNU grep the default

Alan Cox alan.l.cox at
Tue Aug 17 16:56:29 UTC 2010

2010/8/17 Dimitry Andric <dimitry at>

> On 2010-08-16 10:55, Dag-Erling Smørgrav wrote:
> > Dimitry Andric <dimitry at> 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.
> 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:


More information about the freebsd-current mailing list