diff options
author | Salvador Fandino <sfandino@yahoo.com> | 2013-03-12 14:04:35 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2013-03-12 14:56:27 +0000 |
commit | 77d27ef6e34ee43b493f2338726532d40c13a985 (patch) | |
tree | e160d97e3b38f9ab59888553abf6656aa562fd5c | |
parent | 1e45dee41f52b1f024a79d4b0b6d582f77d699a0 (diff) | |
download | perl-77d27ef6e34ee43b493f2338726532d40c13a985.tar.gz |
pp_entersub optimization
There is code in pp_entersub() that specifically handles the case where
AvARRAY(@_) != AvALLOC(@_), and tries to be more efficient than just
realloc()ing AvALLOC().
However, @_'s that have been shifted or messed with are usually cleaned up
or abandoned by CLEAR_ARGARRAY/POPSUB anyway, so this code is (probably)
never called. So remove it.
In a worst case, it would just mean that realloc() is called
unnecessarily, which would be slower, but still correct.
-rw-r--r-- | pp_hot.c | 21 |
1 files changed, 8 insertions, 13 deletions
@@ -2807,19 +2807,14 @@ try_autoload: cx->blk_sub.argarray = av; ++MARK; - if (items > AvMAX(av) + 1) { - SV **ary = AvALLOC(av); - if (AvARRAY(av) != ary) { - AvMAX(av) += AvARRAY(av) - AvALLOC(av); - AvARRAY(av) = ary; - } - if (items > AvMAX(av) + 1) { - AvMAX(av) = items - 1; - Renew(ary,items,SV*); - AvALLOC(av) = ary; - AvARRAY(av) = ary; - } - } + if (items - 1 > AvMAX(av)) { + SV **ary = AvALLOC(av); + AvMAX(av) = items - 1; + Renew(ary, items, SV*); + AvALLOC(av) = ary; + AvARRAY(av) = ary; + } + Copy(MARK,AvARRAY(av),items,SV*); AvFILLp(av) = items - 1; |