[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#21696: [PATCH 1/2] grep: improvement of performance of grep -Fw
From: |
Norihiro Tanaka |
Subject: |
bug#21696: [PATCH 1/2] grep: improvement of performance of grep -Fw |
Date: |
Sat, 17 Oct 2015 10:13:36 +0900 |
I found that grep -Fw is extremely slow in spite of whether in
multibyte locales or not.
$ yes 'abcdefg hijklmn opqrstu vwxyz' | head -100000 >k
$ time -p env LC_ALL=C grep -Fw vwxy k
real 14.03
user 12.51
sys 0.74
$ time -p env LC_ALL=ja_JP.eucJP grep -Fw vwxy k
real 14.29
user 12.67
sys 0.50
$ time -p env LC_ALL=C grep -w vwxy k
real 0.11
user 0.01
sys 0.09
$ time -p env LC_ALL=ja_JP.eucJP grep -w vwxy k
real 0.89
user 0.71
sys 0.15
First patch fixes the problem. Second patch changes as using grep
matcher for grep -Fw in single byte locales.
In single byte locales, DFA (not regex) is also used for words matching,
and it is very fast as above result.
0001-grep-improvement-of-performance-of-grep-Fw.patch
Description: Text document
0002-grep-use-grep-matcher-for-grep-Fw-in-single-byte-loc.patch
Description: Text document