summaryrefslogtreecommitdiff
path: root/regen
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2016-09-19 12:35:13 +0100
committerDavid Mitchell <davem@iabyn.com>2016-10-04 11:18:40 +0100
commit692044df8403d4568b919fe9ad7e282e864ec85e (patch)
treecee2e122d90dc7fc942964679cfd808189e5c390 /regen
parent70027d69be2857dc45d5ff75021fc5f55d6295da (diff)
downloadperl-692044df8403d4568b919fe9ad7e282e864ec85e.tar.gz
Better optimise my/local @a = split()
There are currently two optimisations for when the results of a split are assigned to an array. For the first, @array = split(...); the aassign and padav/rv2av are optimised away, and pp_split() directly assigns to the array attached to the split op (via op_pmtargetoff or op_pmtargetgv). For the second, my @array = split(...); local @array = split(...); @{$expr} = split(...); The aassign is optimised away, but the padav/rv2av is kept as an additional arg to split. pp_split itself then uses the first arg popped off the stack as the array (This was introduced by FC with v5.21.4-409-gef7999f). This commit moves these two: my @array = split(...); local @array = split(...); from the second case to the first case, by simply setting OPpLVAL_INTRO on the OP_SPLIT, and making pp_split() do SAVECLEARSV() or save_ary() as appropriate. This makes my @a = split(...) a few percent faster.
Diffstat (limited to 'regen')
-rw-r--r--regen/op_private4
1 files changed, 2 insertions, 2 deletions
diff --git a/regen/op_private b/regen/op_private
index e511ce145b..d459d479e4 100644
--- a/regen/op_private
+++ b/regen/op_private
@@ -300,7 +300,7 @@ for (qw(nextstate dbstate)) {
# my $x
addbits($_, 7 => qw(OPpLVAL_INTRO LVINTRO))
- for qw(gvsv rv2sv rv2hv rv2gv rv2av aelem helem aslice
+ for qw(gvsv rv2sv rv2hv rv2gv rv2av aelem helem aslice split
hslice delete padsv padav padhv enteriter entersub padrange
pushmark cond_expr refassign lvref lvrefslice lvavref multideref),
'list', # this gets set in my_attrs() for some reason
@@ -732,11 +732,11 @@ addbits('coreargs',
addbits('split',
- 7 => qw(OPpSPLIT_IMPLIM IMPLIM), # implicit limit
# @a = split() has been replaced with split() where split itself
# does the array assign
4 => qw(OPpSPLIT_ASSIGN ASSIGN),
3 => qw(OPpSPLIT_LEX LEX), # the OPpSPLIT_ASSIGN is a lexical array
+ 2 => qw(OPpSPLIT_IMPLIM IMPLIM), # implicit limit
);