This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
add intuit-only match to s///
authorDavid Mitchell <davem@iabyn.com>
Tue, 18 Jun 2013 15:17:39 +0000 (16:17 +0100)
committerDavid Mitchell <davem@iabyn.com>
Sun, 28 Jul 2013 09:33:35 +0000 (10:33 +0100)
commitc147a04bc3fb05d37e3e4df4e349eee460dde7c5
treecf7e9d5065fd8b5861c2fff60c1e05b4ebf83b65
parent7fadf4a7d2f1ec5af858f49a8493aacdee541a8b
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.
pp_hot.c