grep -i in a multibyte locale is now typically 10 times faster
for patterns that do not contain \ or [.
grep (without -i) in a multibyte locale is now up to 7 times faster
when processing many matched lines.
"The trick is to realize that for some search strings, it is easy to convert to an equivalent one that is handled much more efficiently.
E.G. convert this command:
grep -i foobar k
to this:
grep '[fF][oO][oO][bB][aA][rR]' k
That allows the matcher to search in buffer mode, rather than having to extract/case-convert/search each line separately. Currently, we perform this conversion only when search strings contain neither '\' nor '['."
3 comments
[ 5.0 ms ] story [ 20.6 ms ] threadImprovements
taken from the commit log:
"The trick is to realize that for some search strings, it is easy to convert to an equivalent one that is handled much more efficiently. E.G. convert this command:
to this: That allows the matcher to search in buffer mode, rather than having to extract/case-convert/search each line separately. Currently, we perform this conversion only when search strings contain neither '\' nor '['."