diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2014-11-03 20:34:25 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2014-11-03 20:34:25 +0200 |
commit | c9936ef0d4d7a7f263831bead31c5ffcf8b0a8d3 (patch) | |
tree | b0d66bbd999fad91ae1025224fea17755d6ecc4d | |
parent | c5227d1685aa158e63d4b6a6289063ae985673c1 (diff) | |
download | egawk-c9936ef0d4d7a7f263831bead31c5ffcf8b0a8d3.tar.gz egawk-c9936ef0d4d7a7f263831bead31c5ffcf8b0a8d3.tar.bz2 egawk-c9936ef0d4d7a7f263831bead31c5ffcf8b0a8d3.zip |
Use dfa superset to speed up matching.
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | re.c | 9 |
2 files changed, 11 insertions, 2 deletions
@@ -1,3 +1,7 @@ +2014-11-03 Norihiro Tanaka <noritnk@kcn.ne.jp> + + * re.c (research): Use dfa superset to improve matching speed. + 2014-11-02 Arnold D. Robbins <arnold@skeeve.com> * profile.c (div_on_left_mul_on_right): New function. @@ -284,13 +284,18 @@ research(Regexp *rp, char *str, int start, if (rp->dfa && ! no_bol && ! need_start) { char save; size_t count = 0; + struct dfa *superset = dfasuperset(rp->dfareg); /* * dfa likes to stick a '\n' right after the matched * text. So we just save and restore the character. */ save = str[start+len]; - ret = dfaexec(rp->dfareg, str+start, str+start+len, true, - &count, &try_backref); + if (superset) + ret = dfaexec(superset, str+start, str+start+len, + true, NULL, NULL); + if (ret) + ret = dfaexec(rp->dfareg, str+start, str+start+len, + true, &count, &try_backref); str[start+len] = save; } |