summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2011-10-16 12:47:21 -0600
committerKarl Williamson <public@khwilliamson.com>2011-10-17 21:52:17 -0600
commit77a6d8568e288ad300ad7f0805946559b4ec28d1 (patch)
tree7b6281d683ce12dfd390312b6de067c0643d4144
parent227968da0f4293e121ecb5c36b17ddc98da70dc1 (diff)
downloadperl-77a6d8568e288ad300ad7f0805946559b4ec28d1.tar.gz
regexec.c: Less work in /i matching
If you watch an execution trace of regexec /i, often you will see it folding the same thing over and over, as it backtracks or searches ahead. regcomp.c has now been changed to always fold UTF-8 encoded EXACTF and EXCACTFU nodes. This allows these to not be re-folded each time. This commit does it just for find_by_class(). Other commits will expand this technique for other cases.
-rw-r--r--regexec.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/regexec.c b/regexec.c
index 6100fce1e1..071eec65fc 100644
--- a/regexec.c
+++ b/regexec.c
@@ -1465,7 +1465,9 @@ S_find_byclass(pTHX_ regexp * prog, const regnode *c, char *s,
case EXACTF:
if (UTF_PATTERN || utf8_target) {
- utf8_fold_flags = 0;
+
+ /* regcomp.c already folded this if pattern is in UTF-8 */
+ utf8_fold_flags = (UTF_PATTERN) ? FOLDEQ_S2_ALREADY_FOLDED : 0;
goto do_exactf_utf8;
}
fold_array = PL_fold;
@@ -1483,7 +1485,7 @@ S_find_byclass(pTHX_ regexp * prog, const regnode *c, char *s,
case EXACTFU:
if (UTF_PATTERN || utf8_target) {
- utf8_fold_flags = 0;
+ utf8_fold_flags = (UTF_PATTERN) ? FOLDEQ_S2_ALREADY_FOLDED : 0;
goto do_exactf_utf8;
}