Subject: [PATCH] no longer use CSET for non-UTF8 locale in DFA engine
From: Norihiro Tanaka <[email-masked]>
To: [email-masked]
Date: Sat, 01 Mar 2014 18:48:22 +0900
List-Id: <debbugs-submit.debbugs.gnu.org>

Package: grep
Tags: patch

I have overlooked the important thing about optimization by
trivial_case_ignore.  After optimization by trivial_case_ignore,
kwset engine can be used yet.  However, if remove trivial_case_ignore,
it's never used longer because kwsmusts does nothing when MB_CUR_MAX > 1
&& match_icase.

The patch reverts removal of trivial_case_ignore and fixes 200x slower
for non-UTF8 locales with another approach.  It always prefers CSET to
replacement to OR and no longer use CSET for non-UTF8 locales in DFA
engine.

It can also optimize by trivial_case_ignore and enables to speed-up >20x
for non-UTF8 locales. (I tested it with euc-jp)

Norihiro