diff options
Diffstat (limited to 't/perf')
-rw-r--r-- | t/perf/benchmarks | 5 | ||||
-rw-r--r-- | t/perf/optree.t | 7 |
2 files changed, 11 insertions, 1 deletions
diff --git a/t/perf/benchmarks b/t/perf/benchmarks index f02a06a299..56987bcf27 100644 --- a/t/perf/benchmarks +++ b/t/perf/benchmarks @@ -993,6 +993,11 @@ setup => 'my $s = "abc:def"; my $r = []', code => '@$r = split /:/, $s, 2;', }, + 'func::split::arraylist' => { + desc => 'split into an array with extra arg', + setup => 'my @a; my $s = "abc:def";', + code => '@a = (split(/:/, $s, 2), 1);', + }, 'loop::block' => { diff --git a/t/perf/optree.t b/t/perf/optree.t index a2ff7f283c..49959ce666 100644 --- a/t/perf/optree.t +++ b/t/perf/optree.t @@ -10,7 +10,7 @@ BEGIN { @INC = '../lib'; } -plan 54; +plan 59; use v5.10; # state use B qw(svref_2object @@ -74,6 +74,11 @@ for my $test ( [ "---", '(undef,$x) = f()', 'single scalar on LHS' ], [ "---", '($x,$y) = ($x)', 'single scalar on RHS, no AGG' ], [ "--A", '($x,@b) = ($x)', 'single scalar on RHS' ], + [ "--A", 'my @a; @a = (@a = split())', 'split a/a' ], + [ "--A", 'my (@a,@b); @a = (@b = split())', 'split a/b' ], + [ "---", 'my @a; @a = (split(), 1)', '(split(),1)' ], + [ "---", '@a = (split(//, @a), 1)', 'split(@a)' ], + [ "--A", 'my @a; my $ar = @a; @a = (@$ar = split())', 'a/ar split' ], ) { my ($exp, $code, $desc) = @$test; my $sub = eval "sub { $code }" |