This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make COW-clobbering faster
authorFather Chrysostomos <sprout@cpan.org>
Thu, 24 Nov 2011 09:16:32 +0000 (01:16 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Thu, 24 Nov 2011 09:45:32 +0000 (01:45 -0800)
commit8d5a2b776c0bcd54f74daf2876ae0bd37e87f7c0
tree04cb7f30a6d5d5a17cf127add8c4373734e933eb
parent804b5ed7b6140d5110359c81438a8dea7f5b0e04
Make COW-clobbering faster

There is this special SV_COW_DROP_PV flag that gets passed to
sv_force_normal_flags to signal that the SV is about to be clobbered,
so there is no point in allocating a new PV.  But this flag was not
actually being used, until the previous commit commandeered it for
globs (despite the name).

Now it actually does what it says.

Before and after:

$ time ./perl -e '$x = __PACKAGE__, undef $x for 1..8000000'

real 0m5.758s
user 0m5.740s
sys 0m0.008s
$ time ./perl -e '$x = __PACKAGE__, undef $x for 1..8000000'

real 0m3.290s
user 0m3.282s
sys 0m0.006s
sv.c