Subject: bug#31074: Grep -i is slow

From: Paul Eggert <[email-masked]>
Date: Fri, 6 Apr 2018 12:35:30 -0700

It sounds like you've run into a bug that was fixed in grep 2.18 
(2014-02-20). Please try grep 3.1, the current version. If that doesn't 
work, it'd be helpful if you could give us a reproducible test case. 
Here's how I tried (and failed) to reproduce the problem on Fedora 27 
x86-64, which has grep 3.1:

$ shuf -i 1-20000000 >rawindex
$ ls -l rawindex
-rw-r--r--. 1 eggert eggert 168888897 Apr  6 12:30 rawindex
$ time grep outgoing.*harris.*dcraw rawindex

real    0m0.069s
user    0m0.013s
sys     0m0.055s
$ time grep -i outgoing.*harris.*dcraw rawindex

real    0m0.418s
user    0m0.368s
sys     0m0.048s
$ time grep 
'[Oo][Uu][Tt][Gg][Oo][Ii][Nn][Gg].*[Hh][Aa][Rr][Rr][Ii][Ss].*[Dd][Cc][Rr][Aa][Ww]' 
rawindex

real    0m0.416s
user    0m0.357s
sys     0m0.058s
$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=