Why grep -i is so slow? How to do it faster for ASCII?
Posted
by
Vi.
on Super User
See other posts from Super User
or by Vi.
Published on 2011-09-06T12:55:03Z
Indexed on
2012/03/27
23:33 UTC
Read the original article
Hit count: 248
$ 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).
© Super User or respective owner