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.

[1]  Robert S. Boyer,et al.  A fast string searching algorithm , 1977, CACM.

[2]  P. J. Weinberger The UNIX system: Cheap dynamic instruction counting , 1984, AT&T Bell Laboratories Technical Journal.

[3]  R. Nigel Horspool,et al.  Practical fast searching in strings , 1980, Softw. Pract. Exp..