Subject: bug#17229: [PATCH 2/2] grep: speed-up by using memchr() in Boyer-Moore searching

From: Norihiro Tanaka <[email-masked]>
Date: Thu, 24 Apr 2014 02:51:43 +0900

Paul Eggert wrote:
> This improves the performance quite a bit for the test case given in
> the ChangeLog entry.  I also tested performance on Sparc Solaris 10,
> and memchr was a big win there.

You are right.  I also ran the tests on Solaris 10 and HP-UX 11iv2.
memchr() was win on both machines.  Especially on HP-UX 11iv2, memchr was
10x faster than delta1 searching.

By the way, could you also test below for master and original grep-2.18?

$ yes abcdabc | head -50000000 >../k
$ env LANG=C time -p src/grep abcd.bd ../k

Perhaps, later will be faster.

0001-grep-speed-up-by-replacing-incr-to-add-in-x86-and-x8.patch will fix
it.  delta2 searching is higher cost than mind2 searching in original
grep-2.18.  We need to reduce it for delta2 searching.

Norihiro