Subject: Re: bug#16823: Use DFA regex engine on fgrep matcher

From: Norihiro Tanaka <[email-masked]>
Date: Thu, 20 Feb 2014 23:28:19 +0900

In following case, about 200-400x faster. It's equal to performance of grep.
Patch#16232 may also work effectively.

- Before the patch

$ yes $(printf '%078dm' 0)| head -1000000 | tr 0 a > in
$ for i in 1 2 3 4 5; do env LC_ALL=ja_JP.UTF-8 time src/fgrep -i 'ａ' in; done
Command exited with non-zero status 1
7.46user 0.91system 0:08.62elapsed 97%CPU (0avgtext+0avgdata 2624maxresident)k
0inputs+0outputs (0major+188minor)pagefaults 0swaps
Command exited with non-zero status 1
7.94user 0.84system 0:09.13elapsed 96%CPU (0avgtext+0avgdata 2624maxresident)k
0inputs+0outputs (0major+188minor)pagefaults 0swaps
Command exited with non-zero status 1
7.72user 0.76system 0:08.83elapsed 96%CPU (0avgtext+0avgdata 2624maxresident)k
0inputs+0outputs (0major+188minor)pagefaults 0swaps
Command exited with non-zero status 1
7.77user 0.62system 0:08.74elapsed 96%CPU (0avgtext+0avgdata 2608maxresident)k
0inputs+0outputs (0major+187minor)pagefaults 0swaps
Command exited with non-zero status 1
8.03user 0.71system 0:09.08elapsed 96%CPU (0avgtext+0avgdata 2624maxresident)k
0inputs+0outputs (0major+188minor)pagefaults 0swaps

- After the patch

$ yes $(printf '%078dm' 0)| head -1000000 | tr 0 a > in
$ for i in 1 2 3 4 5; do env LC_ALL=ja_JP.UTF-8 time src/fgrep -i 'ａ' in; done
Command exited with non-zero status 1
0.04user 0.08system 0:00.14elapsed 90%CPU (0avgtext+0avgdata 3008maxresident)k
0inputs+0outputs (0major+212minor)pagefaults 0swaps
Command exited with non-zero status 1
0.02user 0.04system 0:00.08elapsed 89%CPU (0avgtext+0avgdata 3008maxresident)k
0inputs+0outputs (0major+226minor)pagefaults 0swaps
Command exited with non-zero status 1
0.02user 0.05system 0:00.08elapsed 89%CPU (0avgtext+0avgdata 3024maxresident)k
0inputs+0outputs (0major+213minor)pagefaults 0swaps
Command exited with non-zero status 1
0.02user 0.05system 0:00.09elapsed 83%CPU (0avgtext+0avgdata 3024maxresident)k
0inputs+0outputs (0major+213minor)pagefaults 0swaps
Command exited with non-zero status 1
0.02user 0.04system 0:00.07elapsed 93%CPU (0avgtext+0avgdata 3024maxresident)k
0inputs+0outputs (0major+213minor)pagefaults 0swaps