In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/77bac227771c643a8a6e305b2bac4665a8f772d1?hp=c85ae797ecb755d3bcfabd44aa268e3e6e2e7c13>
- Log ----------------------------------------------------------------- commit 77bac227771c643a8a6e305b2bac4665a8f772d1 Author: Nicholas Clark <[email protected]> Date: Sun May 30 11:51:15 2010 +0100 Only allocate entries for @_ when the subroutine is first called. Previously, @_ was allocated for every subroutine at compile time, with a default sized AV, hence space for 4 entries. We don't actually need to allocate the space for entries, as there is already a check at call time as to whether @_ is long enough. valgrind suggests that this saves allocating 23K (on a 64 bit platform) when running pod2man on perlfunc.pod. As well as the absolute saving, there is also benefit in deferring allocation for subroutines actually called - for a program which forks, @_ is less likely to be in pages shared COW with the parent. Resolves RT #72416. ----------------------------------------------------------------------- Summary of changes: pad.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/pad.c b/pad.c index 8015154..f297e54 100644 --- a/pad.c +++ b/pad.c @@ -200,7 +200,6 @@ Perl_pad_new(pTHX_ int flags) */ AV * const a0 = newAV(); /* will be @_ */ - av_extend(a0, 0); av_store(pad, 0, MUTABLE_SV(a0)); AvREIFY_only(a0); } @@ -1299,7 +1298,6 @@ Perl_pad_tidy(pTHX_ padtidy_type type) else if (type == padtidy_SUB) { /* XXX DAPM this same bit of code keeps appearing !!! Rationalise? */ AV * const av = newAV(); /* Will be @_ */ - av_extend(av, 0); av_store(PL_comppad, 0, MUTABLE_SV(av)); AvREIFY_only(av); } @@ -1742,7 +1740,6 @@ Perl_pad_push(pTHX_ PADLIST *padlist, int depth) } } av = newAV(); - av_extend(av, 0); av_store(newpad, 0, MUTABLE_SV(av)); AvREIFY_only(av); -- Perl5 Master Repository
