re_intuit_start(): don't decrease other_last
authorDavid Mitchell <davem@iabyn.com>
Fri, 7 Feb 2014 16:43:19 +0000 (16:43 +0000)
committerDavid Mitchell <davem@iabyn.com>
Sat, 8 Feb 2014 14:04:55 +0000 (14:04 +0000)
commitec19cf6bc850473f27f9bb92a316cd58fd76797c
treef9b15b83a992a1035c37bee788ad46576d6e7637
parente7a14a9c2dc20193ef41eda2055fda4ef2dc6c6e
re_intuit_start(): don't decrease other_last

The /^../m failure code did an unconditional other_last = rx_origin;
if other_last was already high, it could get shrunk and we'd end
up running fbm over the same bit of string repeatedly.

The following code

    $s = "-ab\n" x 500_000;
    $s .= 'abx';
    $s =~ /^ab.*x/m;

(which went quadratic on length) reduces from minutes to millisecs with
this commit.  This is because we'd keep going back to near the beginning
of the string and searching for 'x' again.
regexec.c
t/re/pat.t