diff options
author | Norihiro Tanaka <noritnk@kcn.ne.jp> | 2020-09-20 15:39:13 +0900 |
---|---|---|
committer | Jim Meyering <meyering@fb.com> | 2020-09-22 08:46:26 -0700 |
commit | ae65513edc80a1b65f19264b9bed95d870602967 (patch) | |
tree | 73f431df76c3a3b4f9572f27d1cdf79c1d49f3da /NEWS | |
parent | 34ada37baac651312b0e30092c086833a7223df6 (diff) | |
download | grep-ae65513edc80a1b65f19264b9bed95d870602967.tar.gz |
grep: avoid unnecessary regex compilation
Grep resorts to using the regex engine when the precision of either
-o or --color is required, or when the pattern is not supported by
our DFA engine (e.g., backref). Otherwise, grep would perform regex
compilation solely to check the syntax. This change makes grep skip
that compilation in the common case for which it is unnecessary.
The compilation we are avoiding is quite costly, consuming O(N^2)
RSS for N regular expressions.
* src/dfasearch.c (GEAcompile): Add new argument, and avoid unneeded
compilation of regex.
* src/grep.c (compile_fp_t): Update prototype.
(main): Update caller.
* src/kwsearch.c (Fcompile): Update caller and add new argument.
* src/pcresearch.c (Pcompile): Add new argument.
* src/search.h (GEAcompile, Fcompile, Pcompile): Update prototype.
Diffstat (limited to 'NEWS')
0 files changed, 0 insertions, 0 deletions