summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2012-08-24 16:17:47 +0100
committerDavid Mitchell <davem@iabyn.com>2012-09-08 15:42:07 +0100
commita41aa44d9dc4a3ba586d871754bd11137bdc37a2 (patch)
treecf9777a88b54f956185fc04cf3b93adfe64692ef /pp_ctl.c
parent9414be0160a1f343d4ae75ec161fec610da39c84 (diff)
downloadperl-a41aa44d9dc4a3ba586d871754bd11137bdc37a2.tar.gz
stop $foo =~ /(bar)/g skipping copy
Normally in the presence of captures, a successful regex execution makes a copy of the matched string, so that $1 et al give the right value even if the original string is changed; i.e. $foo =~ /(123)/g; $foo = "bar"; is("$1", "123"); Until now that test would fail, because perl used to skip the copy for the scalar /(...)/g case (but not the C<$&; //g> case). This was to avoid a huge slowdown in code like the following: $x = 'x' x 1_000_000; 1 while $x =~ /(.)/g; which would otherwise end up copying a 1Mb string a million times. Now that (with the last commit but one) we copy only the required substring of the original string (a 1-byte substring in the above example), we can remove this fast-but-incorrect hack.
Diffstat (limited to 'pp_ctl.c')
0 files changed, 0 insertions, 0 deletions