Ironically, this may only be because grep uses very well tuned, not immediately straightforward algorithms. See in particular http://lists.freebsd.org/pipermail/freebsd-current/2010-Augu...
Great quote from that referenced post.
Ah, here it is:
https://news.ycombinator.com/item?id=2393587
And again!
https://news.ycombinator.com/item?id=6813937
And duplicate submissions are listed in those postings.
Ironically, this may only be because grep uses very well tuned, not immediately straightforward algorithms. See in particular http://lists.freebsd.org/pipermail/freebsd-current/2010-Augu...