summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorSalvador Fandino <sfandino@yahoo.com>2013-03-12 14:04:35 +0000
committerDavid Mitchell <davem@iabyn.com>2013-03-12 14:56:27 +0000
commit77d27ef6e34ee43b493f2338726532d40c13a985 (patch)
treee160d97e3b38f9ab59888553abf6656aa562fd5c /pp_hot.c
parent1e45dee41f52b1f024a79d4b0b6d582f77d699a0 (diff)
downloadperl-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.
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/pp_hot.c b/pp_hot.c
index ad99c42dae..8871593484 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -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;