Why grep -i is so slow? How to do it faster for ASCII?
- by Vi.
$ time lzop -d < tvtropes-index.lzo | egrep -B 5 '[Dd][eE][sS][cC][eE][nN][dD] ?[Ff][rR][oO][mM]'
real 0m0.438s
$ time lzop -d < tvtropes-index.lzo | egrep -B 5 'descend ?from' -i
real 0m11.294s
Both search insensitively. why -i so slow? How to make fast grep -i without entering things [iI][nN] [tT][hH][iI][sS] [wW][aA][Yy]?
For example,
perl -ne 'print if /descend ?from/i'
works fast, but '-B 5' is not as trivial to implement as in grep (as well as other options).