grep -i is extremely slow for moderate and longer patterns
the reason is the current code expands any case insensitive string like "findme" to [Ff][iI][nN][dD][Mm][eE]
this prevents the creation of a "must" pattern on which to run Boyer-Moore
the patch tries to fix it
[titus@utmbox ~/builds]$ find /usr/src/sys/ -name \*.c -type f|xargs cat >/tmp/bigfile.txt
[titus@utmbox ~/builds]$ time grep -c FreeBSD /tmp/bigfile.txt
4044
real 0m0.243s
user 0m0.227s
sys 0m0.016s
[titus@utmbox ~/builds]$ time grep -ic FreeBSD /tmp/bigfile.txt
7835
real 0m8.652s
user 0m8.621s
sys 0m0.032s
#so the case insensitive run si 30-40 times slower. its worse for longer patterns
#load patched library
[titus@utmbox ~/builds]$ export LD_LIBRARY_PATH=/usr/obj/home/titus/builds/usr/src/arm64.aarch64/lib/libregex/
[titus@utmbox ~/builds]$ time grep -ic FreeBSD /tmp/bigfile.txt
7835
real 0m0.263s
user 0m0.231s
sys 0m0.032s