Did you benchmark read() vs mmap()? Most tools seem to go
with read() for grep-like io patterns.
In fact looks like GNU grep has --mmap switch and it's a little bit faster in the simple case than default on my Ubuntu system. But -i makes mmap slower. Maybe GNU grep
just avoids mmap because of error handling
(you get a segfault/bus error instead of an io error return
when things go wrong).
In fact looks like GNU grep has --mmap switch and it's a little bit faster in the simple case than default on my Ubuntu system. But -i makes mmap slower. Maybe GNU grep just avoids mmap because of error handling (you get a segfault/bus error instead of an io error return when things go wrong).