This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
sv_grow: performance improvement for short strings
authorReini Urban <rurban@x-ray.at>
Wed, 27 Aug 2014 17:48:35 +0000 (12:48 -0500)
committerFather Chrysostomos <sprout@cpan.org>
Thu, 28 Aug 2014 01:17:58 +0000 (18:17 -0700)
commit880c169bb2bd5e6e9ae996842d6860bf88d28585
tree93a20b983f965fbde2d289710c6375f475424a30
parent8f1287bb93a0c5357089ec22fdc1c5ff9b19875e
sv_grow: performance improvement for short strings

Empty COW strings with CUR=0 ended up allocated as LEN=10.
Now they are rounded up to 4 or 8.

Timings:
+0   16.394324103 0.27%
+2   16.114379842 0.01%
+4   16.305622265 1.03%
+8   16.337438609 1.30%
+10  16.675009468 0.59%
with LD_LIBRARY_PATH=`pwd` perf stat -r2 ./perl t/harness t/op/*.t

+2 was consistently the best number, and +10 the worst.
sv.c