Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
COWification seems expensive in PADMY variables #13880
This is a bug report for perl from firstname.lastname@example.org,
It appears that in 5.20 returning string from a lexical variable is
I would guess this is because the return creates a new temporary value out
See attached script for a benchmark
Site configuration information for perl 5.20.0:
Configured by leon at Tue May 27 11:32:58 CEST 2014.
Summary of my perl5 (revision 5 version 20 subversion 0) configuration:
@INC for perl 5.20.0:
Environment for perl 5.20.0:
On Wed May 28 13:27:16 2014, LeonT wrote:
Leon, I didn't get quite the same results as you did. Please see file attached which reports results on two Linux x86_64 machines and one Linux i686 machine.
Thank you very much.
# current laptop
$ uname -a
$ perl 121977-leont-cow.pl 300000
# dromedary blead
# older Linode
This is perl 5, version 20, subversion 0 (v5.20.0) built for i686-linux
$ uname -a
$ perl 121977-leont-cow.pl 100000
On Thu, May 29, 2014 at 12:46 AM, James E Keenan via RT <
Those are the results I was expecting.
I have no idea what's going on there.
On Thu, May 29, 2014 at 12:22:42PM +0200, Leon Timmermans wrote:
i.e. that although COW has made some things faster in 5.20.0 compared with
The commit below fixes the proximate cause. However, there were three
('x' x 1_000_000) is constant folded at compile time, and the COW code
$buf = 'x' x 1_000_000;
and is copying instead. I think FC did some work on making COW work with
The second issue is that, to work around the problem with readline
push @a, $_ while <>;
we added a heuristic along the lines of 'copy rather than COW' if
SvLEN = SvCUR * B;
for some fudge factor B (i.e. over-allocate when growing the buffer).
If B > A, we end up creating strings that can't be COWed. So we probably
Anyway, here's my commit:
when unCOWing a string, set SvCUR to 0
On Thu Jun 05 08:16:02 2014, davem wrote:
This ticket is listed in perl5201delta. Is there still work happening here?
On Fri, Feb 26, 2016 at 10:34:50AM -0800, email@example.com via RT wrote:
The other two issues I mentioned still appear to to be issues;