[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#24037: [PATCH] grep: always match single line only with DFA superset
From: |
Norihiro Tanaka |
Subject: |
bug#24037: [PATCH] grep: always match single line only with DFA superset |
Date: |
Thu, 21 Jul 2016 00:26:17 +0900 |
When grep matcher uses DFA, I assumed that it might match multiline with
DFA superset, but it is wrong. \n cannot occur inside a multibyte
character. So an input always matches single line only with DFA superset.
Now set ALLOW_NL to 0, and remove loop. It speeds up 2x in special case.
$ yes "$(printf 'a\nb')" | head -100000000 >k
(before)
$ time -p src/grep '\(a\|x\).\(b\|x\)' k
real 1.39
user 1.05
sys 0.31
(after)
$ time -p src/grep '\(a\|x\).\(b\|x\)' k
real 0.58
user 0.49
sys 0.09
0001-grep-always-match-single-line-only-with-DFA-superset.patch
Description: Text document
- bug#24037: [PATCH] grep: always match single line only with DFA superset,
Norihiro Tanaka <=