bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#43527: [PATCH] grep: avoid unneeded compilation of regex


From: Norihiro Tanaka
Subject: bug#43527: [PATCH] grep: avoid unneeded compilation of regex
Date: Sun, 20 Sep 2020 16:16:43 +0900

Hi,

Performace for as following case is fixed in bug#43040.

  $ yes 0 | head -100000 | sed '$s/././' >pat
  $ grep -vf pat /dev/null

However, still slow and a lot of memory wasted for the following cases.

  $ grep -vf /usr/share/dict/linux.words /usr/share/dict/linux.words

This bug is introduced in commit abb7f4f2325f26f930ff59b702fe42568a8e81e7.
Though it's an optimization for patterns with backreferences, it seems
to cause performance degradation in many cases due to regex
implementation issues.

grep needs regex engine when patterns is not supported by DFA engine,
and when either given only matching (-o) or color option (--color) is
given.

In other words, if none of them are met, grep only uses regex to check
the syntax.  grep avoids compilation of regex not to check syntax by this
patch.

Attachment: 0001-grep-avoid-unneeded-compilation-of-regex.patch
Description: Text document

Attachment: 0001-dfa-change-dfasupported-to-global-function.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]