Min string length for COW
authorFather Chrysostomos <sprout@cpan.org>
Fri, 19 Oct 2012 16:52:03 +0000 (09:52 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Tue, 27 Nov 2012 15:05:01 +0000 (07:05 -0800)
commit9fd2152b911b1c311a72e55728050bfa2fc67ca6
tree950b43e85d3be67b4356dde499e02327ddaa844c
parentdb2c6cb33ec067c880a2cb3c4efdb33f7e3e3d0f
Min string length for COW

We have two separate length thresholds for when copy-on-write kicks
in, one for when a buffer would have had to be (re)allocated
(SV_COW_THRESHOLD) and another for when there is already a large
enough buffer available (SV_COWBUF_THRESHOLD).

Benchmarking against mktables and against Test.Simple’s test suite
(see JS::Test::Simple on CPAN) run with WWW::Scripter and JE shows
that 0/1250 is the best combination, at least on 32-bit darwin.

Apparently, copying into an existing buffer is much faster than the
bookkeeping overhead of sv_force_normal_flags (which I see no way to
speed up).

I have defined these conditionally with #ifndef, so that platform-spe-
cific hints can override them with values appropriate to the platform.

Also, refactor things in sv_setsv_flags slightly to avoid using SvLEN
and SvCUR repeatedly.
sv.c
sv.h