That's not what I suggested. I was saying if you're writing performance sensitive code with a hot loop calling `egrep` then a smarter approach might be to use a language better tuned for performance which supports regex libraries.
Shell scripts have their place and can out perform most languages if you're writing simple logic that can run across large datasets in parallel, such as
cat very-large-file | grep "do not want" | sed -r 's/foo/bar/' > very-large-file-refactored
(please excuse the useless use of `cat`, it's there to illustrate the direction of data flow)
But in those types of scenarios the cost of $SHELL interpretation and fork() is massively outweighed by the savings of stream processing.
So my point was: if you're writing a function which $SHELL interpretation and/or fork() create enough of a performance impact where you're looking to optimize how you exec `grep -E`, then maybe it's time to investigate whether $SHELL is the right language to write your function in.
Rewrite grep in python before running - got it. :P