aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2016-08-14 17:24:34 +0300
committerArnold D. Robbins <arnold@skeeve.com>2016-08-14 17:24:34 +0300
commit129913aed0568a75e513c19efcc0016128a1fa43 (patch)
tree846f19cb8e8af8978d299a31d7923ab8b9a7af83
parent06bf7db6b1d3f666f4209a3602a4996d6742e71a (diff)
parent0703039505200ca5126e11d905a6fa40c602d1b9 (diff)
downloadegawk-129913aed0568a75e513c19efcc0016128a1fa43.tar.gz
egawk-129913aed0568a75e513c19efcc0016128a1fa43.tar.bz2
egawk-129913aed0568a75e513c19efcc0016128a1fa43.zip
Merge branch 'master' into feature/cmake
-rw-r--r--ChangeLog6
-rw-r--r--re.c12
2 files changed, 14 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index a8aed231..dbc826bf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2016-08-14 Arnold D. Robbins <arnold@skeeve.com>
+
+ * re.c (make_regexp): Only call dfasyntax if actually using
+ dfa. Gives a 14% speedup on this test: https://raw.githubusercontent.com/chadbrewbaker/awka/master/benchmark/regexp.awk.
+ From blathering in comp.lang.awk.
+
2016-08-12 Arnold D. Robbins <arnold@skeeve.com>
* dfa.c: Sync with GNU grep.
diff --git a/re.c b/re.c
index 3b01823b..593ed166 100644
--- a/re.c
+++ b/re.c
@@ -203,10 +203,14 @@ make_regexp(const char *s, size_t len, bool ignorecase, bool dfa, bool canfatal)
syn &= ~RE_ICASE;
}
- dfa_syn = syn;
- if (ignorecase)
- dfa_syn |= RE_ICASE;
- dfasyntax(dfa_syn, ignorecase, '\n');
+ /* only call dfasyntax if we're using dfa; saves time */
+ if (dfa && ! no_dfa) {
+ dfa_syn = syn;
+ /* FIXME: dfa doesn't pay attention RE_ICASE */
+ if (ignorecase)
+ dfa_syn |= RE_ICASE;
+ dfasyntax(dfa_syn, ignorecase, '\n');
+ }
re_set_syntax(syn);
if ((rerr = re_compile_pattern(buf, len, &(rp->pat))) != NULL) {