A tale of two greps



Text searching programs such as the UNIX system tools grep and egrep require more than just good algorithms; they need to make efficient use of system resources such as I/O. I describe improving the I/O management in grep and egrep by using a new fast I/O library fio to replace the normal I/O library stdio. I also describe incorporating the Boyer-Moore algorithm into egrep; egrep is now typically 8–10 (for some common patterns 30–40) times faster than grep.