summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2013-06-18 16:17:39 +0100
committerDavid Mitchell <davem@iabyn.com>2013-07-28 10:33:35 +0100
commitc147a04bc3fb05d37e3e4df4e349eee460dde7c5 (patch)
treecf7e9d5065fd8b5861c2fff60c1e05b4ebf83b65 /pp_hot.c
parent7fadf4a7d2f1ec5af858f49a8493aacdee541a8b (diff)
downloadperl-c147a04bc3fb05d37e3e4df4e349eee460dde7c5.tar.gz
add intuit-only match to s///
pp_match() has an intuit-only match mode: if intuit_start() succeeds and the regex is marked as only needing intuit (RXf_CHECK_ALL), then calling regexec() is skipped, and just $& set and then returns. The commit which originally added that feature to pp_match() also added a comment to pp_subst() suggesting that the same thing could be done there. This commit finally achieves that. It builds on the previous commit (which moved this mechanism from pp_match() directly into regexec()), skipping calling intuit_start() and directly calling regexec() with the REXEC_CHECKED flag not set. This appears to reduce the execution time of a simple substitution like s/abc/def/ by a fifth.
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/pp_hot.c b/pp_hot.c
index ddb0acd2f8..e0a543c8ef 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -2132,28 +2132,15 @@ PP(pp_subst)
#endif
orig = m = s;
- if (RX_EXTFLAGS(rx) & RXf_USE_INTUIT) {
- s = CALLREG_INTUIT_START(rx, TARG, orig, s, strend, r_flags, NULL);
-
- if (!s)
- goto ret_no;
- /* How to do it in subst? */
-/* if ( (RX_EXTFLAGS(rx) & RXf_CHECK_ALL)
- && !PL_sawampersand
- && !(RX_EXTFLAGS(rx) & RXf_KEEPCOPY))
- goto yup;
-*/
- }
- if (!CALLREGEXEC(rx, s, strend, orig, 0, TARG, NULL,
- r_flags | REXEC_CHECKED))
+ if (!CALLREGEXEC(rx, s, strend, orig, 0, TARG, NULL, r_flags))
{
- ret_no:
SPAGAIN;
PUSHs(rpm->op_pmflags & PMf_NONDESTRUCT ? TARG : &PL_sv_no);
LEAVE_SCOPE(oldsave);
RETURN;
}
+ s = RX_OFFS(rx)[0].start + orig;
PL_curpm = pm;