Plain grep 2.5.3: johan@foo:/tmp/johan/grep-2.5.3-orig/src$ time echo hej | ./egrep -f /tmp/ignore hej real 1m8.563s user 1m7.744s sys 0m0.032s With CALLOC rather than MALLOC + for() in epsclosure(): johan@foo:/tmp/johan/grep-2.5.3/src$ time echo hej | ./egrep -f /tmp/ignore hej real 0m24.239s user 0m23.833s sys 0m0.052s With char rather than int as *visited data type in epsclosure(): johan@foo:/tmp/johan/grep-2.5.3/src$ time echo hej | ./egrep -f /tmp/ignore hej real 0m5.776s user 0m5.440s sys 0m0.080s Plain grep, 10334 lines of input: johan@foo:/tmp/johan/grep-2.5.3-orig/src$ time cat /var/log/daemon.log | ./egrep -f /tmp/ignore > /dev/null real 1m10.425s user 1m10.240s sys 0m0.048s Grep + MALLOC->CALLOC + int->char + 10334 lines of input: johan@foo:/tmp/johan/grep-2.5.3/src$ time cat /var/log/daemon.log | ./egrep -f /tmp/ignore > /dev/null real 0m5.690s user 0m5.656s sys 0m0.040s