GNU bug report logs - #21696
[PATCH 1/2] grep: improvement of performance of grep -Fw

Previous Next

Package: grep;

Reported by: Norihiro Tanaka <noritnk <at> kcn.ne.jp>

Date: Sat, 17 Oct 2015 01:14:02 UTC

Severity: normal

Tags: patch

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#21696: closed ([PATCH 1/2] grep: improvement of performance
 of grep -Fw)
Date: Sat, 17 Oct 2015 05:49:01 +0000
[Message part 1 (text/plain, inline)]
Your message dated Fri, 16 Oct 2015 22:48:07 -0700
with message-id <5621E117.8040201 <at> cs.ucla.edu>
and subject line Re: bug#21696: [PATCH 1/2] grep: improvement of performance of grep -Fw
has caused the debbugs.gnu.org bug report #21696,
regarding [PATCH 1/2] grep: improvement of performance of grep -Fw
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
21696: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=21696
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Norihiro Tanaka <noritnk <at> kcn.ne.jp>
To: <bug-grep <at> gnu.org>
Subject: [PATCH 1/2] grep: improvement of performance of grep -Fw
Date: Sat, 17 Oct 2015 10:13:36 +0900
[Message part 3 (text/plain, inline)]
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 (text/plain, attachment)]
[0002-grep-use-grep-matcher-for-grep-Fw-in-single-byte-loc.patch (text/plain, attachment)]
[Message part 6 (message/rfc822, inline)]
From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Norihiro Tanaka <noritnk <at> kcn.ne.jp>, 21696-done <at> debbugs.gnu.org
Subject: Re: bug#21696: [PATCH 1/2] grep: improvement of performance of grep
 -Fw
Date: Fri, 16 Oct 2015 22:48:07 -0700
[Message part 7 (text/plain, inline)]
Thanks for those performance improvements. I installed them, with some minor 
changes to commentary. I also installed a couple of minor tweaks to the code, to 
use memrchr and to simplify the multibyte test. Attached are the revised set of 
patches.
[0001-grep-improve-performance-of-grep-Fw.patch (text/plain, attachment)]
[0002-grep-use-memchr-memrchar.patch (text/plain, attachment)]
[0003-grep-use-grep-matcher-for-grep-Fw-when-unibyte.patch (text/plain, attachment)]
[0004-grep-simplify-previous-change.patch (text/plain, attachment)]
[0005-maint-add-news-item.patch (text/plain, attachment)]

This bug report was last modified 9 years and 276 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.