This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix a benchmarks sprintf entry
[perl5.git] / t / perf / benchmarks
index 1e4cd72..0bebf54 100644 (file)
 #
 #     call::     subroutine and method handling
 #     expr::     expressions: e.g. $x=1, $foo{bar}[0]
+#     func::     perl functions, e.g. func::sort::...
 #     loop::     structural code like for, while(), etc
 #     regex::    regular expressions
 #     string::   string handling
 #
 #
-# Each hash has three fields:
+# Each hash has up to five fields:
+#
+#   desc  is a description of the test; if not present, it defaults
+#           to the same value as the 'code' field
+#
+#   setup is an optional string containing setup code that is run once
 #
-#   desc is a description of the test
-#   setup is a string containing setup code
 #   code  is a string containing the code to run in a loop
 #
-# So typically a benchmark tool might do something like
+#   pre   is an optional string containing setup code which is executed
+#         just before 'code' for every iteration, but whose execution
+#         time is not included in the result
+#
+#   post  like pre, but executed just after 'code'.
+#
+# So typically a benchmark tool might execute variations on something like
 #
-#   eval "package $token; $setup; for (1..1000000) { $code }"
+#   eval "package $name; $setup; for (1..1000000) { $pre; $code; $post }"
 #
 # Currently the only tool that uses this file is Porting/bench.pl;
 # try C<perl Porting/bench.pl --help> for more info
+#
+# ------
+#
+# Note: for the cachegrind variant, an entry like
+#    'foo::bar' => {
+#     setup   => 'SETUP',
+#     pre     => 'PRE',
+#     code    => 'CODE',
+#     post    => 'POST',
+#   }
+# creates two temporary perl sources looking like:
+#
+#        package foo::bar;
+#        BEGIN { srand(0) }
+#        SETUP;
+#        for my $__loop__ (1..$ARGV[0]) {
+#            PRE; 1; POST;
+#        }
+#
+# and as above, but with the loop body replaced with:
+#
+#            PRE; CODE; POST;
+#
+# It then pipes each of the two sources into
+#
+#     PERL_HASH_SEED=0 valgrind [options] someperl [options] - N
+#
+# where N is set to 10 and then 20.
+#
+# It then uses the result of those four cachegrind runs to subtract out
+# the perl startup and loop overheads (including SETUP, PRE and POST), leaving
+# (in theory only CODE);
+#
+# Note that misleading results may be obtained if each iteration is
+# not identical. For example with
+#
+#     code => '$x .= "foo"',
+#
+# the string $x gets longer on each iteration. Similarly, a hash might be
+# empty on the first iteration, but have entries on subsequent iterations.
+#
+# To avoid this, use 'pre' or 'post', e.g.
+#
+#     pre  => '$x  = ""',
+#     code => '$x .= "foo"',
+#
+# Finally, the optional 'compile' key causes the code body to be wrapped
+# in eval qw{ sub { ... }}, so that compile time rather than execution
+# time is measured.
 
 
 [
-    'call::sub::3_args' => {
+    'call::sub::empty' => {
+        desc    => 'function call with no args or body',
+        setup   => 'sub f { }',
+        code    => 'f()',
+    },
+    'call::sub::amp_empty' => {
+        desc    => '&foo function call with no args or body',
+        setup   => 'sub f { }; @_ = ();',
+        code    => '&f',
+    },
+    'call::sub::args3' => {
         desc    => 'function call with 3 local lexical vars',
-        setup   => 'sub f { my ($a, $b, $c) = @_ }',
+        setup   => 'sub f { my ($a, $b, $c) = @_; 1 }',
+        code    => 'f(1,2,3)',
+    },
+    'call::sub::args2_ret1' => {
+        desc    => 'function call with 2 local lex vars and 1 return value',
+        setup   => 'my $x; sub f { my ($a, $b) = @_; $a+$b }',
+        code    => '$x = f(1,2)',
+    },
+    'call::sub::args2_ret1temp' => {
+        desc    => 'function call with 2 local lex vars and 1 return TEMP value',
+        setup   => 'my $x; sub f { my ($a, $b) = @_; \$a }',
+        code    => '$x = f(1,2)',
+    },
+    'call::sub::args3_ret3' => {
+        desc    => 'function call with 3 local lex vars and 3 return values',
+        setup   => 'my @a; sub f { my ($a, $b, $c) = @_; $a+$b, $c, 1 }',
+        code    => '@a = f(1,2,3)',
+    },
+    'call::sub::args3_ret3str' => {
+        desc    => 'function call with 3 local lex vars and 3 string return values',
+        setup   => 'my @a; sub f { my ($a, $b, $c) = @_; my @s = ("aa","bb","cc"); @s }',
+        code    => '@a = f(1,2,3)',
+    },
+    'call::sub::args3_ret3temp' => {
+        desc    => 'function call with 3 local lex vars and 3 TEMP return values',
+        setup   => 'my @a; sub f { my ($a, $b, $c) = @_; 1..3 }',
+        code    => '@a = f(1,2,3)',
+    },
+    'call::sub::recursive' => {
+        desc    => 'basic recursive function call',
+        setup   => 'my $x; sub f { my ($i) = @_; $i > 0 ? $i + f($i-1) : 0 }',
+        code    => '$x = f(1)',
+    },
+
+    'call::goto::empty' => {
+        desc    => 'goto &funtion with no args or body',
+        setup   => 'sub f { goto &g } sub g {}',
+        code    => 'f()',
+    },
+    'call::goto::args3' => {
+        desc    => 'goto &funtion with 3 local lexical vars',
+        setup   => 'sub f { goto &g } sub g { my ($a, $b, $c) = @_ }',
         code    => 'f(1,2,3)',
     },
 
     'expr::array::ref_expr_lex_3const' => {
         desc    => '(lexical expr)->[const][const][const]',
         setup   => 'my $r = [[[1,2]]]',
-        code    => '($r//0)->[0][0][0]',
+        code    => '($r||0)->[0][0][0]',
     },
 
 
     'expr::array::pkg_1const_0' => {
         desc    => 'package $array[0]',
-        setup   => 'our @a = (1)',
+        setup   => '@a = (1)',
         code    => '$a[0]',
     },
     'expr::array::pkg_1const_m1' => {
         desc    => 'package $array[-1]',
-        setup   => 'our @a = (1)',
+        setup   => '@a = (1)',
         code    => '$a[-1]',
     },
     'expr::array::pkg_2const' => {
         desc    => 'package $array[const][const]',
-        setup   => 'our @a = ([1,2])',
+        setup   => '@a = ([1,2])',
         code    => '$a[0][1]',
     },
     'expr::array::pkg_2var' => {
         desc    => 'package $array[$i1][$i2]',
-        setup   => 'our ($i1,$i2) = (0,1); our @a = ([1,2])',
+        setup   => '($i1,$i2) = (0,1); @a = ([1,2])',
         code    => '$a[$i1][$i2]',
     },
     'expr::array::ref_pkg_2var' => {
         desc    => 'package $arrayref->[$i1][$i2]',
-        setup   => 'our ($i1,$i2) = (0,1); our $r = [[1,2]]',
+        setup   => '($i1,$i2) = (0,1); $r = [[1,2]]',
         code    => '$r->[$i1][$i2]',
     },
     'expr::array::ref_pkg_3const' => {
         desc    => 'package $arrayref->[const][const][const]',
-        setup   => 'our $r = [[[1,2]]]',
+        setup   => '$r = [[[1,2]]]',
         code    => '$r->[0][0][0]',
     },
     'expr::array::ref_expr_pkg_3const' => {
         desc    => '(package expr)->[const][const][const]',
-        setup   => 'our $r = [[[1,2]]]',
-        code    => '($r//0)->[0][0][0]',
+        setup   => '$r = [[[1,2]]]',
+        code    => '($r||0)->[0][0][0]',
     },
 
+    'expr::array::lex_bool_empty' => {
+        desc    => 'empty lexical array in boolean context',
+        setup   => 'my @a;',
+        code    => '!@a',
+    },
+    'expr::array::lex_bool_full' => {
+        desc    => 'non-empty lexical array in boolean context',
+        setup   => 'my @a = 1..10;',
+        code    => '!@a',
+    },
+    'expr::array::lex_scalar_empty' => {
+        desc    => 'empty lexical array in scalar context',
+        setup   => 'my (@a, $i);',
+        code    => '$i = @a',
+    },
+    'expr::array::lex_scalar_full' => {
+        desc    => 'non-empty lexical array in scalar context',
+        setup   => 'my @a = 1..10; my $i',
+        code    => '$i = @a',
+    },
+    'expr::array::pkg_bool_empty' => {
+        desc    => 'empty lexical array in boolean context',
+        setup   => 'our @a;',
+        code    => '!@a',
+    },
+    'expr::array::pkg_bool_full' => {
+        desc    => 'non-empty lexical array in boolean context',
+        setup   => 'our @a = 1..10;',
+        code    => '!@a',
+    },
+    'expr::array::pkg_scalar_empty' => {
+        desc    => 'empty lexical array in scalar context',
+        setup   => 'our @a; my $i;',
+        code    => '$i = @a',
+    },
+    'expr::array::pkg_scalar_full' => {
+        desc    => 'non-empty lexical array in scalar context',
+        setup   => 'our @a = 1..10; my $i',
+        code    => '$i = @a',
+    },
 
     'expr::arrayhash::lex_3var' => {
         desc    => 'lexical $h{$k1}[$i]{$k2}',
     },
     'expr::arrayhash::pkg_3var' => {
         desc    => 'package $h{$k1}[$i]{$k2}',
-        setup   => 'our ($i, $k1, $k2) = (0,"foo","bar");'
-                    . 'our %h = (foo => [ { bar => 1 } ])',
+        setup   => '($i, $k1, $k2) = (0,"foo","bar");'
+                    . '%h = (foo => [ { bar => 1 } ])',
         code    => '$h{$k1}[$i]{$k2}',
     },
 
-
-    'expr::assign::scalar_lex' => {
-        desc    => 'lexical $x = 1',
-        setup   => 'my $x',
-        code    => '$x = 1',
-    },
-    'expr::assign::2list_lex' => {
-        desc    => 'lexical ($x, $y) = (1, 2)',
-        setup   => 'my ($x, $y)',
-        code    => '($x, $y) = (1, 2)',
-    },
-
-
     'expr::hash::lex_1const' => {
         desc    => 'lexical $hash{const}',
         setup   => 'my %h = ("foo" => 1)',
     'expr::hash::ref_expr_lex_3const' => {
         desc    => '(lexical expr)->{const}{const}{const}',
         setup   => 'my $r = {foo => { bar => { baz => 1 }}}',
-        code    => '($r//0)->{foo}{bar}{baz}',
+        code    => '($r||0)->{foo}{bar}{baz}',
     },
 
-
     'expr::hash::pkg_1const' => {
         desc    => 'package $hash{const}',
-        setup   => 'our %h = ("foo" => 1)',
+        setup   => '%h = ("foo" => 1)',
         code    => '$h{foo}',
     },
     'expr::hash::pkg_2const' => {
         desc    => 'package $hash{const}{const}',
-        setup   => 'our %h = (foo => { bar => 1 })',
+        setup   => '%h = (foo => { bar => 1 })',
         code    => '$h{foo}{bar}',
     },
     'expr::hash::pkg_2var' => {
         desc    => 'package $hash{$k1}{$k2}',
-        setup   => 'our ($k1,$k2) = qw(foo bar); our %h = ($k1 => { $k2 => 1 })',
+        setup   => '($k1,$k2) = qw(foo bar); %h = ($k1 => { $k2 => 1 })',
         code    => '$h{$k1}{$k2}',
     },
     'expr::hash::ref_pkg_2var' => {
         desc    => 'package $hashref->{$k1}{$k2}',
-        setup   => 'our ($k1,$k2) = qw(foo bar); our $r = {$k1 => { $k2 => 1 }}',
+        setup   => '($k1,$k2) = qw(foo bar); $r = {$k1 => { $k2 => 1 }}',
         code    => '$r->{$k1}{$k2}',
     },
     'expr::hash::ref_pkg_3const' => {
         desc    => 'package $hashref->{const}{const}{const}',
-        setup   => 'our $r = {foo => { bar => { baz => 1 }}}',
+        setup   => '$r = {foo => { bar => { baz => 1 }}}',
         code    => '$r->{foo}{bar}{baz}',
     },
     'expr::hash::ref_expr_pkg_3const' => {
         desc    => '(package expr)->{const}{const}{const}',
-        setup   => 'our $r = {foo => { bar => { baz => 1 }}}',
-        code    => '($r//0)->{foo}{bar}{baz}',
+        setup   => '$r = {foo => { bar => { baz => 1 }}}',
+        code    => '($r||0)->{foo}{bar}{baz}',
     },
 
 
         setup   => 'my ($k1,$k2) = qw(foo bar); my %h = ($k1 => { $k2 => 1 });',
         code    => 'exists $h{$k1}{$k2}',
     },
+
+    'expr::hash::bool_empty' => {
+        desc    => 'empty lexical hash in boolean context',
+        setup   => 'my %h;',
+        code    => '!%h',
+    },
+    'expr::hash::bool_empty_unknown' => {
+        desc    => 'empty lexical hash in unknown context',
+        setup   => 'my ($i, %h); sub f { if (%h) { $i++ }}',
+        code    => 'f()',
+    },
+    'expr::hash::bool_full' => {
+        desc    => 'non-empty lexical hash in boolean context',
+        setup   => 'my %h = 1..10;',
+        code    => '!%h',
+    },
+
+
+    (
+        map {
+            sprintf('expr::hash::notexists_lex_keylen%04d',$_) => {
+                desc    => 'exists on non-key of length '. $_,
+                setup   => 'my %h; my $key = "A" x ' . $_ . '; $h{$key."x"} = 1;',
+                code    => 'exists $h{$key}',
+            },
+        } (
+            1 .. 24,
+            # 1,2,3,7,8,9,14,15,16,20,24,
+            50,
+            100,
+            1000,
+        )
+    ),
+    (
+        map {
+            sprintf('expr::hash::exists_lex_keylen%04d',$_) => {
+                desc    => 'exists on existing key of length '. $_,
+                setup   => 'my %h; my $key = "A" x ' . $_ . '; $h{$key} = 1;',
+                code    => 'exists $h{$key}',
+            },
+        } (
+            1 .. 24,
+            # 1,2,3,7,8,9,14,15,16,20,24,
+            50,
+            100,
+            1000,
+        )
+    ),
+
     'expr::hash::delete_lex_2var' => {
         desc    => 'lexical delete $hash{$k1}{$k2}',
         setup   => 'my ($k1,$k2) = qw(foo bar); my %h = ($k1 => { $k2 => 1 });',
     },
 
 
-    'expr::index::utf8_postion_1' => {
+    # list assign, OP_AASSIGN
+
+
+    # (....) = ()
+
+    'expr::aassign::ma_empty' => {
+        desc    => 'my array assigned empty',
+        setup   => '',
+        code    => 'my @a = ()',
+    },
+    'expr::aassign::lax_empty' => {
+        desc    => 'non-empty lexical array assigned empty',
+        setup   => 'my @a = 1..3;',
+        code    => '@a = ()',
+    },
+    'expr::aassign::llax_empty' => {
+        desc    => 'non-empty lexical var and array assigned empty',
+        setup   => 'my ($x, @a) = 1..4;',
+        code    => '($x, @a) = ()',
+    },
+    'expr::aassign::mh_empty' => {
+        desc    => 'my hash assigned empty',
+        setup   => '',
+        code    => 'my %h = ()',
+    },
+    'expr::aassign::lhx_empty' => {
+        desc    => 'non-empty lexical hash assigned empty',
+        setup   => 'my %h = 1..4;',
+        code    => '%h = ()',
+    },
+    'expr::aassign::llhx_empty' => {
+        desc    => 'non-empty lexical var and hash assigned empty',
+        setup   => 'my ($x, %h) = 1..5;',
+        code    => '($x, %h) = ()',
+    },
+    'expr::aassign::3m_empty' => {
+        desc    => 'three my vars assigned empty',
+        setup   => '',
+        code    => 'my ($x,$y,$z) = ()',
+    },
+    'expr::aassign::3l_empty' => {
+        desc    => 'three lexical vars assigned empty',
+        setup   => 'my ($x,$y,$z)',
+        code    => '($x,$y,$z) = ()',
+    },
+    'expr::aassign::3lref_empty' => {
+        desc    => 'three lexical ref vars assigned empty',
+        setup   => 'my ($x,$y,$z); my $r = []; ',
+        code    => '($x,$y,$z) = ($r,$r,$r); ($x,$y,$z) = ()',
+    },
+    'expr::aassign::pa_empty' => {
+        desc    => 'package array assigned empty',
+        setup   => '',
+        code    => '@a = ()',
+    },
+    'expr::aassign::pax_empty' => {
+        desc    => 'non-empty package array assigned empty',
+        setup   => '@a = (1,2,3)',
+        code    => '@a = ()',
+    },
+    'expr::aassign::3p_empty' => {
+        desc    => 'three package vars assigned empty',
+        setup   => '($x,$y,$z) = 1..3;',
+        code    => '($x,$y,$z) = ()',
+    },
+
+    # (....) = (1,2,3)
+
+    'expr::aassign::ma_3c' => {
+        desc    => 'my array assigned 3 consts',
+        setup   => '',
+        code    => 'my @a = (1,2,3)',
+    },
+    'expr::aassign::lax_3c' => {
+        desc    => 'non-empty lexical array assigned 3 consts',
+        setup   => 'my @a = 1..3;',
+        code    => '@a = (1,2,3)',
+    },
+    'expr::aassign::llax_3c' => {
+        desc    => 'non-empty lexical var and array assigned 3 consts',
+        setup   => 'my ($x, @a) = 1..4;',
+        code    => '($x, @a) = (1,2,3)',
+    },
+    'expr::aassign::mh_4c' => {
+        desc    => 'my hash assigned 4 consts',
+        setup   => '',
+        code    => 'my %h = qw(a 1 b 2)',
+    },
+    'expr::aassign::lhx_4c' => {
+        desc    => 'non-empty lexical hash assigned 4 consts',
+        setup   => 'my %h = qw(a 1 b 2);',
+        code    => '%h = qw(c 3 d 4)',
+    },
+    'expr::aassign::llhx_5c' => {
+        desc    => 'non-empty lexical var and array assigned 5 consts',
+        setup   => 'my ($x, %h) = (1, qw(a 1 b 2));',
+        code    => '($x, %h) = (10, qw(c 3 d 4))',
+    },
+    'expr::aassign::3m_3c' => {
+        desc    => 'three my vars assigned 3 consts',
+        setup   => '',
+        code    => 'my ($x,$y,$z) = (1,2,3)',
+    },
+    'expr::aassign::3l_3c' => {
+        desc    => 'three lexical vars assigned 3 consts',
+        setup   => 'my ($x,$y,$z)',
+        code    => '($x,$y,$z) = (1,2,3)',
+    },
+    'expr::aassign::pa_3c' => {
+        desc    => 'package array assigned 3 consts',
+        setup   => '',
+        code    => '@a = (1,2,3)',
+    },
+    'expr::aassign::pax_3c' => {
+        desc    => 'non-empty package array assigned 3 consts',
+        setup   => '@a = (1,2,3)',
+        code    => '@a = (1,2,3)',
+    },
+    'expr::aassign::3p_3c' => {
+        desc    => 'three package vars assigned 3 consts',
+        setup   => '($x,$y,$z) = 1..3;',
+        code    => '($x,$y,$z) = (1,2,3)',
+    },
+
+    # (....) = @lexical
+
+    'expr::aassign::ma_la' => {
+        desc    => 'my array assigned lexical array',
+        setup   => 'my @init = 1..3;',
+        code    => 'my @a = @init',
+    },
+    'expr::aassign::lax_la' => {
+        desc    => 'non-empty lexical array assigned lexical array',
+        setup   => 'my @init = 1..3; my @a = 1..3;',
+        code    => '@a = @init',
+    },
+    'expr::aassign::llax_la' => {
+        desc    => 'non-empty lexical var and array assigned lexical array',
+        setup   => 'my @init = 1..3; my ($x, @a) = 1..4;',
+        code    => '($x, @a) = @init',
+    },
+    'expr::aassign::3m_la' => {
+        desc    => 'three my vars assigned lexical array',
+        setup   => 'my @init = 1..3;',
+        code    => 'my ($x,$y,$z) = @init',
+    },
+    'expr::aassign::3l_la' => {
+        desc    => 'three lexical vars assigned lexical array',
+        setup   => 'my @init = 1..3; my ($x,$y,$z)',
+        code    => '($x,$y,$z) = @init',
+    },
+    'expr::aassign::pa_la' => {
+        desc    => 'package array assigned lexical array',
+        setup   => 'my @init = 1..3;',
+        code    => '@a = @init',
+    },
+    'expr::aassign::pax_la' => {
+        desc    => 'non-empty package array assigned lexical array',
+        setup   => 'my @init = 1..3; @a = @init',
+        code    => '@a = @init',
+    },
+    'expr::aassign::3p_la' => {
+        desc    => 'three package vars assigned lexical array',
+        setup   => 'my @init = 1..3; ($x,$y,$z) = 1..3;',
+        code    => '($x,$y,$z) = @init',
+    },
+
+    # (....) = @package
+
+    'expr::aassign::ma_pa' => {
+        desc    => 'my array assigned package array',
+        setup   => '@init = 1..3;',
+        code    => 'my @a = @init',
+    },
+    'expr::aassign::lax_pa' => {
+        desc    => 'non-empty lexical array assigned package array',
+        setup   => '@init = 1..3; my @a = 1..3;',
+        code    => '@a = @init',
+    },
+    'expr::aassign::llax_pa' => {
+        desc    => 'non-empty lexical var and array assigned package array',
+        setup   => '@init = 1..3; my ($x, @a) = 1..4;',
+        code    => '($x, @a) = @init',
+    },
+    'expr::aassign::3m_pa' => {
+        desc    => 'three my vars assigned package array',
+        setup   => '@init = 1..3;',
+        code    => 'my ($x,$y,$z) = @init',
+    },
+    'expr::aassign::3l_pa' => {
+        desc    => 'three lexical vars assigned package array',
+        setup   => '@init = 1..3; my ($x,$y,$z)',
+        code    => '($x,$y,$z) = @init',
+    },
+    'expr::aassign::pa_pa' => {
+        desc    => 'package array assigned package array',
+        setup   => '@init = 1..3;',
+        code    => '@a = @init',
+    },
+    'expr::aassign::pax_pa' => {
+        desc    => 'non-empty package array assigned package array',
+        setup   => '@init = 1..3; @a = @init',
+        code    => '@a = @init',
+    },
+    'expr::aassign::3p_pa' => {
+        desc    => 'three package vars assigned package array',
+        setup   => '@init = 1..3; ($x,$y,$z) = 1..3;',
+        code    => '($x,$y,$z) = @init',
+    },
+
+    # (....) = @_;
+
+    'expr::aassign::ma_defary' => {
+        desc    => 'my array assigned @_',
+        setup   => '@_ = 1..3;',
+        code    => 'my @a = @_',
+    },
+    'expr::aassign::lax_defary' => {
+        desc    => 'non-empty lexical array assigned @_',
+        setup   => '@_ = 1..3; my @a = 1..3;',
+        code    => '@a = @_',
+    },
+    'expr::aassign::llax_defary' => {
+        desc    => 'non-empty lexical var and array assigned @_',
+        setup   => '@_ = 1..3; my ($x, @a) = 1..4;',
+        code    => '($x, @a) = @_',
+    },
+    'expr::aassign::3m_defary' => {
+        desc    => 'three my vars assigned @_',
+        setup   => '@_ = 1..3;',
+        code    => 'my ($x,$y,$z) = @_',
+    },
+    'expr::aassign::3l_defary' => {
+        desc    => 'three lexical vars assigned @_',
+        setup   => '@_ = 1..3; my ($x,$y,$z)',
+        code    => '($x,$y,$z) = @_',
+    },
+    'expr::aassign::pa_defary' => {
+        desc    => 'package array assigned @_',
+        setup   => '@_ = 1..3;',
+        code    => '@a = @_',
+    },
+    'expr::aassign::pax_defary' => {
+        desc    => 'non-empty package array assigned @_',
+        setup   => '@_ = 1..3; @a = @_',
+        code    => '@a = @_',
+    },
+    'expr::aassign::3p_defary' => {
+        desc    => 'three package vars assigned @_',
+        setup   => '@_ = 1..3; ($x,$y,$z) = 1..3;',
+        code    => '($x,$y,$z) = @_',
+    },
+
+    # (....) = %lexical
+
+    'expr::aassign::ma_lh' => {
+        desc    => 'my array assigned lexical hash',
+        setup   => 'my %h = qw(aardvark 1 banana 2 cucumber 3)',
+        code    => 'my @a = %h',
+    },
+
+
+    # (....) = ($lex1,$lex2,$lex3);
+
+    'expr::aassign::ma_3l' => {
+        desc    => 'my array assigned lexicals',
+        setup   => 'my ($v1,$v2,$v3) = 1..3;',
+        code    => 'my @a = ($v1,$v2,$v3)',
+    },
+    'expr::aassign::lax_3l' => {
+        desc    => 'non-empty lexical array assigned lexicals',
+        setup   => 'my ($v1,$v2,$v3) = 1..3; my @a = 1..3;',
+        code    => '@a = ($v1,$v2,$v3)',
+    },
+    'expr::aassign::llax_3l' => {
+        desc    => 'non-empty lexical var and array assigned lexicals',
+        setup   => 'my ($v1,$v2,$v3) = 1..3; my ($x, @a) = 1..4;',
+        code    => '($x, @a) = ($v1,$v2,$v3)',
+    },
+    'expr::aassign::3m_3l' => {
+        desc    => 'three my vars assigned lexicals',
+        setup   => 'my ($v1,$v2,$v3) = 1..3;',
+        code    => 'my ($x,$y,$z) = ($v1,$v2,$v3)',
+    },
+    'expr::aassign::3l_3l' => {
+        desc    => 'three lexical vars assigned lexicals',
+        setup   => 'my ($v1,$v2,$v3) = 1..3; my ($x,$y,$z)',
+        code    => '($x,$y,$z) = ($v1,$v2,$v3)',
+    },
+    'expr::aassign::pa_3l' => {
+        desc    => 'package array assigned lexicals',
+        setup   => 'my ($v1,$v2,$v3) = 1..3;',
+        code    => '@a = ($v1,$v2,$v3)',
+    },
+    'expr::aassign::pax_3l' => {
+        desc    => 'non-empty package array assigned lexicals',
+        setup   => 'my ($v1,$v2,$v3) = 1..3; @a = @_',
+        code    => '@a = ($v1,$v2,$v3)',
+    },
+    'expr::aassign::3p_3l' => {
+        desc    => 'three package vars assigned lexicals',
+        setup   => 'my ($v1,$v2,$v3) = 1..3; ($x,$y,$z) = 1..3;',
+        code    => '($x,$y,$z) = ($v1,$v2,$v3)',
+    },
+
+
+    # (....) = ($pkg1,$pkg2,$pkg3);
+
+    'expr::aassign::ma_3p' => {
+        desc    => 'my array assigned 3 package vars',
+        setup   => '($v1,$v2,$v3) = 1..3;',
+        code    => 'my @a = ($v1,$v2,$v3)',
+    },
+    'expr::aassign::lax_3p' => {
+        desc    => 'non-empty lexical array assigned 3 package vars',
+        setup   => '($v1,$v2,$v3) = 1..3; my @a = 1..3;',
+        code    => '@a = ($v1,$v2,$v3)',
+    },
+    'expr::aassign::llax_3p' => {
+        desc    => 'non-empty lexical var and array assigned 3 package vars',
+        setup   => '($v1,$v2,$v3) = 1..3; my ($x, @a) = 1..4;',
+        code    => '($x, @a) = ($v1,$v2,$v3)',
+    },
+    'expr::aassign::3m_3p' => {
+        desc    => 'three my vars assigned 3 package vars',
+        setup   => '($v1,$v2,$v3) = 1..3;',
+        code    => 'my ($x,$y,$z) = ($v1,$v2,$v3)',
+    },
+    'expr::aassign::3l_3p' => {
+        desc    => 'three lexical vars assigned 3 package vars',
+        setup   => '($v1,$v2,$v3) = 1..3; my ($x,$y,$z)',
+        code    => '($x,$y,$z) = ($v1,$v2,$v3)',
+    },
+    'expr::aassign::pa_3p' => {
+        desc    => 'package array assigned 3 package vars',
+        setup   => '($v1,$v2,$v3) = 1..3;',
+        code    => '@a = ($v1,$v2,$v3)',
+    },
+    'expr::aassign::pax_3p' => {
+        desc    => 'non-empty package array assigned 3 package vars',
+        setup   => '($v1,$v2,$v3) = 1..3; @a = @_',
+        code    => '@a = ($v1,$v2,$v3)',
+    },
+    'expr::aassign::3p_3p' => {
+        desc    => 'three package vars assigned 3 package vars',
+        setup   => '($v1,$v2,$v3) = 1..3; ($x,$y,$z) = 1..3;',
+        code    => '($x,$y,$z) = ($v1,$v2,$v3)',
+    },
+
+
+    # (....) = (1,2,$shared);
+
+    'expr::aassign::llax_2c1s' => {
+        desc    => 'non-empty lexical var and array assigned 2 consts and 1 shared var',
+        setup   => 'my ($x, @a) = 1..4;',
+        code    => '($x, @a) = (1,2,$x)',
+    },
+    'expr::aassign::3l_2c1s' => {
+        desc    => 'three lexical vars assigned 2 consts and 1 shared var',
+        setup   => 'my ($x,$y,$z) = 1..3;',
+        code    => '($x,$y,$z) = (1,2,$x)',
+    },
+    'expr::aassign::3p_2c1s' => {
+        desc    => 'three package vars assigned 2 consts and 1 shared var',
+        setup   => '($x,$y,$z) = 1..3;',
+        code    => '($x,$y,$z) = (1,2,$x)',
+    },
+
+
+    # ($a,$b) = ($b,$a);
+
+    'expr::aassign::2l_swap' => {
+        desc    => 'swap two lexical vars',
+        setup   => 'my ($a,$b) = (1,2)',
+        code    => '($a,$b) = ($b,$a)',
+    },
+    'expr::aassign::2p_swap' => {
+        desc    => 'swap two package vars',
+        setup   => '($a,$b) = (1,2)',
+        code    => '($a,$b) = ($b,$a)',
+    },
+    'expr::aassign::2laelem_swap' => {
+        desc    => 'swap two lexical vars',
+        setup   => 'my @a = (1,2)',
+        code    => '($a[0],$a[1]) = ($a[1],$a[0])',
+    },
+
+    # misc list assign
+
+    'expr::aassign::5l_4l1s' => {
+        desc    => 'long list of lexical vars, 1 shared',
+        setup   => 'my ($a,$b,$c,$d,$e) = 1..5',
+        code    => '($a,$b,$c,$d,$e) = ($a,$a,$c,$d,$e)',
+    },
+
+    'expr::aassign::5p_4p1s' => {
+        desc    => 'long list of package vars, 1 shared',
+        setup   => '($a,$b,$c,$d,$e) = 1..5',
+        code    => '($a,$b,$c,$d,$e) = ($a,$a,$c,$d,$e)',
+    },
+    'expr::aassign::5l_defary' => {
+        desc    => 'long list of lexical vars to assign @_ to',
+        setup   => '@_ = 1..5',
+        code    => 'my ($a,$b,$c,$d,$e) = @_',
+    },
+    'expr::aassign::5l1la_defary' => {
+        desc    => 'long list of lexical vars plus long slurp to assign @_ to',
+        setup   => '@_ = 1..20',
+        code    => 'my ($a,$b,$c,$d,$e,@rest) = @_',
+    },
+    'expr::aassign::1l_2l' => {
+        desc    => 'single lexical LHS',
+        setup   => 'my $x = 1;',
+        code    => '(undef,$x) = ($x,$x)',
+    },
+    'expr::aassign::2l_1l' => {
+        desc    => 'single lexical RHS',
+        setup   => 'my $x = 1;',
+        code    => '($x,$x) = ($x)',
+    },
+    'expr::aassign::2l_1ul' => {
+        desc    => 'undef and single lexical RHS',
+        setup   => 'my $x = 1;',
+        code    => '($x,$x) = (undef, $x)',
+    },
+
+    'expr::aassign::2list_lex' => {
+        desc    => 'lexical ($x, $y) = (1, 2)',
+        setup   => 'my ($x, $y)',
+        code    => '($x, $y) = (1, 2)',
+    },
+
+    'expr::aassign::lex_rv' => {
+        desc    => 'lexical ($ref1, $ref2) = ($ref3, $ref4)',
+        setup   => 'my ($r1, $r2, $r3, $r4);
+                    ($r1, $r2) = (($r3, $r4) = ([],  []));',
+        code    => '($r1, $r2) = ($r3, $r4)',
+    },
+
+    'expr::aassign::lex_rv1' => {
+        desc    => 'lexical ($ref1, $ref2) = ($ref3, $ref4) where ref1,2 are freed',
+        setup   => 'my ($r1, $r2);',
+        code    => '($r1, $r2) = ([], []);',
+    },
+
+    'expr::aassign::boolean' => {
+        desc    => '!(@a = @b)',
+        setup   => 'my ($s,@a, @b); @b = (1,2)',
+        code    => '!(@a = @b);',
+    },
+    'expr::aassign::scalar' => {
+        desc    => '$scalar = (@a = @b)',
+        setup   => 'my ($s, @a, @b); @b = (1,2)',
+        code    => '$s = (@a = @b);',
+    },
+
+    # array assign of strings
+
+    'expr::aassign::la_3s' => {
+        desc    => 'assign 3 strings to empty lexical array',
+        setup   => 'my @a',
+        code    => '@a = (); @a = qw(abc defg hijkl);',
+    },
+    'expr::aassign::la_3ts' => {
+        desc    => 'assign 3 temp strings to empty lexical array',
+        setup   => 'my @a',
+        code    => '@a = (); @a = map $_, qw(abc defg hijkl);',
+    },
+    'expr::aassign::lan_3s' => {
+        desc    => 'assign 3 strings to non-empty lexical array',
+        setup   => 'my @a = qw(abc defg hijkl)',
+        code    => '@a = qw(abc defg hijkl);',
+    },
+    'expr::aassign::lan_3ts' => {
+        desc    => 'assign 3 temp strings to non-empty lexical array',
+        setup   => 'my @a = qw(abc defg hijkl)',
+        code    => '@a = map $_, qw(abc defg hijkl);',
+    },
+
+    # hash assign of strings
+
+    'expr::aassign::lh_2s' => {
+        desc    => 'assign 2 strings to empty lexical hash',
+        setup   => 'my %h',
+        code    => '%h = (); %h = qw(k1 abc k2 defg);',
+    },
+    'expr::aassign::lh_2ts' => {
+        desc    => 'assign 2 temp strings to empty lexical hash',
+        setup   => 'my %h',
+        code    => '%h = (); %h = map $_, qw(k1 abc k2 defg);',
+    },
+    'expr::aassign::lhn_2s' => {
+        desc    => 'assign 2 strings to non-empty lexical hash',
+        setup   => 'my %h = qw(k1 abc k2 defg);',
+        code    => '%h = qw(k1 abc k2 defg);',
+    },
+    'expr::aassign::lhn_2ts' => {
+        desc    => 'assign 2 temp strings to non-empty lexical hash',
+        setup   => 'my %h = qw(k1 abc k2 defg);',
+        code    => '%h = map $_, qw(k1 abc k2 defg);',
+    },
+
+
+    'expr::arith::add_lex_ii' => {
+        desc    => 'add two integers and assign to a lexical var',
+        setup   => 'my ($x,$y,$z) = 1..3;',
+        code    => '$z = $x + $y',
+    },
+    'expr::arith::add_pkg_ii' => {
+        desc    => 'add two integers and assign to a package var',
+        setup   => 'my ($x,$y) = 1..2; $z = 3;',
+        code    => '$z = $x + $y',
+    },
+    'expr::arith::add_lex_nn' => {
+        desc    => 'add two NVs and assign to a lexical var',
+        setup   => 'my ($x,$y,$z) = (1.1, 2.2, 3.3);',
+        code    => '$z = $x + $y',
+    },
+    'expr::arith::add_pkg_nn' => {
+        desc    => 'add two NVs and assign to a package var',
+        setup   => 'my ($x,$y); ($x,$y,$z) = (1.1, 2.2, 3.3);',
+        code    => '$z = $x + $y',
+    },
+    'expr::arith::add_lex_ni' => {
+        desc    => 'add an int and an NV and assign to a lexical var',
+        setup   => 'my ($x,$y,$z) = (1, 2.2, 3.3);',
+        code    => '$z = $x + $y',
+    },
+    'expr::arith::add_pkg_ni' => {
+        desc    => 'add an int and an NV and assign to a package var',
+        setup   => 'my ($x,$y); ($x,$y,$z) = (1, 2.2, 3.3);',
+        code    => '$z = $x + $y',
+    },
+    'expr::arith::add_lex_ss' => {
+        desc    => 'add two short strings and assign to a lexical var',
+        setup   => 'my ($x,$y,$z) = ("1", "2", 1);',
+        code    => '$z = $x + $y; $x = "1"; ',
+    },
+
+    'expr::arith::add_lex_ll' => {
+        desc    => 'add two long strings and assign to a lexical var',
+        setup   => 'my ($x,$y,$z) = ("12345", "23456", 1);',
+        code    => '$z = $x + $y; $x = "12345"; ',
+    },
+
+    'expr::arith::sub_lex_ii' => {
+        desc    => 'subtract two integers and assign to a lexical var',
+        setup   => 'my ($x,$y,$z) = 1..3;',
+        code    => '$z = $x - $y',
+    },
+    'expr::arith::sub_pkg_ii' => {
+        desc    => 'subtract two integers and assign to a package var',
+        setup   => 'my ($x,$y) = 1..2; $z = 3;',
+        code    => '$z = $x - $y',
+    },
+    'expr::arith::sub_lex_nn' => {
+        desc    => 'subtract two NVs and assign to a lexical var',
+        setup   => 'my ($x,$y,$z) = (1.1, 2.2, 3.3);',
+        code    => '$z = $x - $y',
+    },
+    'expr::arith::sub_pkg_nn' => {
+        desc    => 'subtract two NVs and assign to a package var',
+        setup   => 'my ($x,$y); ($x,$y,$z) = (1.1, 2.2, 3.3);',
+        code    => '$z = $x - $y',
+    },
+    'expr::arith::sub_lex_ni' => {
+        desc    => 'subtract an int and an NV and assign to a lexical var',
+        setup   => 'my ($x,$y,$z) = (1, 2.2, 3.3);',
+        code    => '$z = $x - $y',
+    },
+    'expr::arith::sub_pkg_ni' => {
+        desc    => 'subtract an int and an NV and assign to a package var',
+        setup   => 'my ($x,$y); ($x,$y,$z) = (1, 2.2, 3.3);',
+        code    => '$z = $x - $y',
+    },
+
+    'expr::arith::mult_lex_ii' => {
+        desc    => 'multiply two integers and assign to a lexical var',
+        setup   => 'my ($x,$y,$z) = 1..3;',
+        code    => '$z = $x * $y',
+    },
+    'expr::arith::mult_pkg_ii' => {
+        desc    => 'multiply two integers and assign to a package var',
+        setup   => 'my ($x,$y) = 1..2; $z = 3;',
+        code    => '$z = $x * $y',
+    },
+    'expr::arith::mult_lex_nn' => {
+        desc    => 'multiply two NVs and assign to a lexical var',
+        setup   => 'my ($x,$y,$z) = (1.1, 2.2, 3.3);',
+        code    => '$z = $x * $y',
+    },
+    'expr::arith::mult_pkg_nn' => {
+        desc    => 'multiply two NVs and assign to a package var',
+        setup   => 'my ($x,$y); ($x,$y,$z) = (1.1, 2.2, 3.3);',
+        code    => '$z = $x * $y',
+    },
+    'expr::arith::mult_lex_ni' => {
+        desc    => 'multiply an int and an NV and assign to a lexical var',
+        setup   => 'my ($x,$y,$z) = (1, 2.2, 3.3);',
+        code    => '$z = $x * $y',
+    },
+    'expr::arith::mult_pkg_ni' => {
+        desc    => 'multiply an int and an NV and assign to a package var',
+        setup   => 'my ($x,$y); ($x,$y,$z) = (1, 2.2, 3.3);',
+        code    => '$z = $x * $y',
+    },
+
+    # use '!' to test SvTRUE on various classes of value
+
+    'expr::arith::not_PL_undef' => {
+        desc    => '!undef (using PL_sv_undef)',
+        setup   => 'my $x',
+        code    => '$x = !undef',
+    },
+    'expr::arith::not_PL_no' => {
+        desc    => '!($x == $y) (using PL_sv_no)',
+        setup   => 'my ($x, $y) = (1,2); my $z;',
+        code    => '$z = !($x == $y)',
+    },
+    'expr::arith::not_PL_zero' => {
+        desc    => '!%h (using PL_sv_zero)',
+        setup   => 'my ($x, %h)',
+        code    => '$x = !%h',
+    },
+    'expr::arith::not_PL_yes' => {
+        desc    => '!($x == $y) (using PL_sv_yes)',
+        setup   => 'my ($x, $y) = (1,1); my $z;',
+        code    => '$z = !($x == $y)',
+    },
+    'expr::arith::not_undef' => {
+        desc    => '!$y where $y is undef',
+        setup   => 'my ($x, $y)',
+        code    => '$x = !$y',
+    },
+    'expr::arith::not_0' => {
+        desc    => '!$x where $x is 0',
+        setup   => 'my ($x, $y) = (0, 0)',
+        code    => '$y = !$x',
+    },
+    'expr::arith::not_1' => {
+        desc    => '!$x where $x is 1',
+        setup   => 'my ($x, $y) = (1, 0)',
+        code    => '$y = !$x',
+    },
+    'expr::arith::not_string' => {
+        desc    => '!$x where $x is "foo"',
+        setup   => 'my ($x, $y) = ("foo", 0)',
+        code    => '$y = !$x',
+    },
+    'expr::arith::not_ref' => {
+        desc    => '!$x where $s is an array ref',
+        setup   => 'my ($x, $y) = ([], 0)',
+        code    => '$y = !$x',
+    },
+
+    'expr::arith::preinc' => {
+        setup   => 'my $x = 1;',
+        code    => '++$x',
+    },
+    'expr::arith::predec' => {
+        setup   => 'my $x = 1;',
+        code    => '--$x',
+    },
+    'expr::arith::postinc' => {
+        desc    => '$x++',
+        setup   => 'my $x = 1; my $y',
+        code    => '$y = $x++', # scalar context so not optimised to ++$x
+    },
+    'expr::arith::postdec' => {
+        desc    => '$x--',
+        setup   => 'my $x = 1; my $y',
+        code    => '$y = $x--', # scalar context so not optimised to --$x
+    },
+
+
+
+    # scalar assign, OP_SASSIGN
+   
+
+    'expr::sassign::scalar_lex_int' => {
+        desc    => 'lexical $x = 1',
+        setup   => 'my $x',
+        code    => '$x = 1',
+    },
+    'expr::sassign::scalar_lex_str' => {
+        desc    => 'lexical $x = "abc"',
+        setup   => 'my $x',
+        code    => '$x = "abc"',
+    },
+    'expr::sassign::scalar_lex_strint' => {
+        desc    => 'lexical $x = 1 where $x was previously a string',
+        setup   => 'my $x = "abc"',
+        code    => '$x = 1',
+    },
+    'expr::sassign::scalar_lex_intstr' => {
+        desc    => 'lexical $x = "abc" where $x was previously an int',
+        setup   => 'my $x = 1;',
+        code    => '$x = "abc"',
+    },
+    'expr::sassign::lex_rv' => {
+        desc    => 'lexical $ref1 = $ref2;',
+        setup   => 'my $r1 = []; my $r = $r1;',
+        code    => '$r = $r1;',
+    },
+    'expr::sassign::lex_rv1' => {
+        desc    => 'lexical $ref1 = $ref2; where $$ref1 gets freed',
+        setup   => 'my $r1 = []; my $r',
+        code    => '$r = []; $r = $r1;',
+    },
+
+
+    'func::grep::bool0' => {
+        desc    => 'grep returning 0 items in boolean context',
+        setup   => 'my @a;',
+        code    => '!grep $_, @a;',
+    },
+    'func::grep::bool1' => {
+        desc    => 'grep returning 1 item in boolean context',
+        setup   => 'my @a =(1);',
+        code    => '!grep $_, @a;',
+    },
+    'func::grep::scalar0' => {
+        desc    => 'returning 0 items in scalar context',
+        setup   => 'my $g; my @a;',
+        code    => '$g = grep $_, @a;',
+    },
+    'func::grep::scalar1' => {
+        desc    => 'returning 1 item in scalar context',
+        setup   => 'my $g; my @a =(1);',
+        code    => '$g = grep $_, @a;',
+    },
+
+    # (index() == -1) and variants optimise away the op_const and op_eq
+    # and any assignment to a lexical var
+    'func::index::bool' => {
+        desc    => '(index() == -1) for match',
+        setup   => 'my $x = "aaaab"',
+        code    => 'index($x, "b") == -1',
+    },
+    'func::index::bool_fail' => {
+        desc    => '(index() == -1) for no match',
+        setup   => 'my $x = "aaaab"',
+        code    => 'index($x, "c") == -1',
+    },
+    'func::index::lex_bool' => {
+        desc    => '$lex = (index() == -1) for match',
+        setup   => 'my $r; my $x = "aaaab"',
+        code    => '$r = index($x, "b") == -1',
+    },
+    'func::index::lex_bool_fail' => {
+        desc    => '$lex = (index() == -1) for no match',
+        setup   => 'my $r; my $x = "aaaab"',
+        code    => '$r = index($x, "c") == -1',
+    },
+
+    # using a const string as second arg to index triggers using FBM.
+    # the FBM matcher special-cases 1,2-byte strings.
+    #
+    'func::index::short_const1' => {
+        desc    => 'index of a short string against a 1 char const substr',
+        setup   => 'my $x = "aaaab"',
+        code    => 'index $x, "b"',
+    },
+    'func::index::long_const1' => {
+        desc    => 'index of a long string against a 1 char const substr',
+        setup   => 'my $x = "a" x 1000 . "b"',
+        code    => 'index $x, "b"',
+    },
+    'func::index::short_const2aabc_bc' => {
+        desc    => 'index of a short string against a 2 char const substr',
+        setup   => 'my $x = "aaaabc"',
+        code    => 'index $x, "bc"',
+    },
+    'func::index::long_const2aabc_bc' => {
+        desc    => 'index of a long string against a 2 char const substr',
+        setup   => 'my $x = "a" x 1000 . "bc"',
+        code    => 'index $x, "bc"',
+    },
+    'func::index::long_const2aa_ab' => {
+        desc    => 'index of a long string aaa.. against const substr "ab"',
+        setup   => 'my $x = "a" x 1000',
+        code    => 'index $x, "ab"',
+    },
+    'func::index::long_const2bb_ab' => {
+        desc    => 'index of a long string bbb.. against const substr "ab"',
+        setup   => 'my $x = "b" x 1000',
+        code    => 'index $x, "ab"',
+    },
+    'func::index::long_const2aa_bb' => {
+        desc    => 'index of a long string aaa.. against const substr "bb"',
+        setup   => 'my $x = "a" x 1000',
+        code    => 'index $x, "bb"',
+    },
+    # this one is designed to be pathological
+    'func::index::long_const2ab_aa' => {
+        desc    => 'index of a long string abab.. against const substr "aa"',
+        setup   => 'my $x = "ab" x 500',
+        code    => 'index $x, "aa"',
+    },
+    # near misses with gaps, 1st letter
+    'func::index::long_const2aaxx_xy' => {
+        desc    => 'index of a long string with "xx"s against const substr "xy"',
+        setup   => 'my $x = "aaaaaaaaxx" x 100',
+        code    => 'index $x, "xy"',
+    },
+    # near misses with gaps, 2nd letter
+    'func::index::long_const2aayy_xy' => {
+        desc    => 'index of a long string with "yy"s against const substr "xy"',
+        setup   => 'my $x = "aaaaaaaayy" x 100',
+        code    => 'index $x, "xy"',
+    },
+    # near misses with gaps, duplicate letter
+    'func::index::long_const2aaxy_xx' => {
+        desc    => 'index of a long string with "xy"s against const substr "xx"',
+        setup   => 'my $x = "aaaaaaaaxy" x 100',
+        code    => 'index $x, "xx"',
+    },
+    # alternating near misses with gaps
+    'func::index::long_const2aaxxaayy_xy' => {
+        desc    => 'index of a long string with "xx/yy"s against const substr "xy"',
+        setup   => 'my $x = "aaaaaaaaxxbbbbbbbbyy" x 50',
+        code    => 'index $x, "xy"',
+    },
+    'func::index::short_const3aabcd_bcd' => {
+        desc    => 'index of a short string against a 3 char const substr',
+        setup   => 'my $x = "aaaabcd"',
+        code    => 'index $x, "bcd"',
+    },
+    'func::index::long_const3aabcd_bcd' => {
+        desc    => 'index of a long string against a 3 char const substr',
+        setup   => 'my $x = "a" x 1000 . "bcd"',
+        code    => 'index $x, "bcd"',
+    },
+    'func::index::long_const3ab_abc' => {
+        desc    => 'index of a long string of "ab"s against a 3 char const substr "abc"',
+        setup   => 'my $x = "ab" x 500',
+        code    => 'index $x, "abc"',
+    },
+    'func::index::long_const3bc_abc' => {
+        desc    => 'index of a long string of "bc"s against a 3 char const substr "abc"',
+        setup   => 'my $x = "bc" x 500',
+        code    => 'index $x, "abc"',
+    },
+    'func::index::utf8_position_1' => {
         desc    => 'index of a utf8 string, matching at position 1',
-        setup   => 'utf8::upgrade my $x = "abc"',
+        setup   => 'my $x = "abc". chr(0x100); chop $x',
         code    => 'index $x, "b"',
     },
 
+
+    'func::keys::lex::void_cxt_empty' => {
+        desc    => ' keys() on an empty lexical hash in void context',
+        setup   => 'my %h = ()',
+        code    => 'keys %h',
+    },
+    'func::keys::lex::void_cxt' => {
+        desc    => ' keys() on a non-empty lexical hash in void context',
+        setup   => 'my %h = qw(aardvark 1 banana 2 cucumber 3)',
+        code    => 'keys %h',
+    },
+    'func::keys::lex::bool_cxt_empty' => {
+        desc    => ' keys() on an empty lexical hash in bool context',
+        setup   => 'my %h = ()',
+        code    => '!keys %h',
+    },
+    'func::keys::lex::bool_cxt' => {
+        desc    => ' keys() on a non-empty lexical hash in bool context',
+        setup   => 'my %h = qw(aardvark 1 banana 2 cucumber 3)',
+        code    => '!keys %h',
+    },
+    'func::keys::lex::scalar_cxt_empty' => {
+        desc    => ' keys() on an empty lexical hash in scalar context',
+        setup   => 'my $k; my %h = ()',
+        code    => '$k = keys %h',
+    },
+    'func::keys::lex::scalar_cxt' => {
+        desc    => ' keys() on a non-empty lexical hash in scalar context',
+        setup   => 'my $k; my %h = qw(aardvark 1 banana 2 cucumber 3)',
+        code    => '$k = keys %h',
+    },
+    'func::keys::lex::list_cxt_empty' => {
+        desc    => ' keys() on an empty lexical hash in list context',
+        setup   => 'my %h = ()',
+        code    => '() = keys %h',
+    },
+    'func::keys::lex::list_cxt' => {
+        desc    => ' keys() on a non-empty lexical hash in list context',
+        setup   => 'my %h = qw(aardvark 1 banana 2 cucumber 3)',
+        code    => '() = keys %h',
+    },
+
+    'func::keys::pkg::void_cxt_empty' => {
+        desc    => ' keys() on an empty package hash in void context',
+        setup   => 'our %h = ()',
+        code    => 'keys %h',
+    },
+    'func::keys::pkg::void_cxt' => {
+        desc    => ' keys() on a non-empty package hash in void context',
+        setup   => 'our %h = qw(aardvark 1 banana 2 cucumber 3)',
+        code    => 'keys %h',
+    },
+    'func::keys::pkg::bool_cxt_empty' => {
+        desc    => ' keys() on an empty package hash in bool context',
+        setup   => 'our %h = ()',
+        code    => '!keys %h',
+    },
+    'func::keys::pkg::bool_cxt' => {
+        desc    => ' keys() on a non-empty package hash in bool context',
+        setup   => 'our %h = qw(aardvark 1 banana 2 cucumber 3)',
+        code    => '!keys %h',
+    },
+    'func::keys::pkg::scalar_cxt_empty' => {
+        desc    => ' keys() on an empty package hash in scalar context',
+        setup   => 'my $k; our %h = ()',
+        code    => '$k = keys %h',
+    },
+    'func::keys::pkg::scalar_cxt' => {
+        desc    => ' keys() on a non-empty package hash in scalar context',
+        setup   => 'my $k; our %h = qw(aardvark 1 banana 2 cucumber 3)',
+        code    => '$k = keys %h',
+    },
+    'func::keys::pkg::list_cxt_empty' => {
+        desc    => ' keys() on an empty package hash in list context',
+        setup   => 'our %h = ()',
+        code    => '() = keys %h',
+    },
+    'func::keys::pkg::list_cxt' => {
+        desc    => ' keys() on a non-empty package hash in list context',
+        setup   => 'our %h = qw(aardvark 1 banana 2 cucumber 3)',
+        code    => '() = keys %h',
+    },
+
+
+    'func::length::bool0' => {
+        desc    => 'length==0 in boolean context',
+        setup   => 'my $s = "";',
+        code    => '!length($s);',
+    },
+    'func::length::bool10' => {
+        desc    => 'length==10 in boolean context',
+        setup   => 'my $s = "abcdefghijk";',
+        code    => '!length($s);',
+    },
+    'func::length::scalar10' => {
+        desc    => 'length==10 in scalar context',
+        setup   => 'my $p; my $s = "abcdefghijk";',
+        code    => '$p = length($s);',
+    },
+    'func::length::bool0_utf8' => {
+        desc    => 'utf8 string length==0 in boolean context',
+        setup   => 'my $s = "\x{100}"; chop $s;',
+        code    => '!length($s);',
+    },
+    'func::length::bool10_utf8' => {
+        desc    => 'utf8 string length==10 in boolean context',
+        setup   => 'my $s = "abcdefghij\x{100}";',
+        code    => '!length($s);',
+    },
+    'func::length::scalar10_utf8' => {
+        desc    => 'utf8 string length==10 in scalar context',
+        setup   => 'my $p; my $s = "abcdefghij\x{100}";',
+        code    => '$p = length($s);',
+    },
+
+    'func::pos::bool0' => {
+        desc    => 'pos==0 in boolean context',
+        setup   => 'my $s = "abc"; pos($s) = 0',
+        code    => '!pos($s);',
+    },
+    'func::pos::bool10' => {
+        desc    => 'pos==10 in boolean context',
+        setup   => 'my $s = "abcdefghijk"; pos($s) = 10',
+        code    => '!pos($s);',
+    },
+    'func::pos::scalar10' => {
+        desc    => 'pos==10 in scalar context',
+        setup   => 'my $p; my $s = "abcdefghijk"; pos($s) = 10',
+        code    => '$p = pos($s);',
+    },
+
+    'func::ref::notaref_bool' => {
+        desc    => 'ref($notaref) in boolean context',
+        setup   => 'my $r = "boo"',
+        code    => '!ref $r',
+    },
+    'func::ref::ref_bool' => {
+        desc    => 'ref($ref) in boolean context',
+        setup   => 'my $r = []',
+        code    => '!ref $r',
+    },
+    'func::ref::blessedref_bool' => {
+        desc    => 'ref($blessed_ref) in boolean context',
+        setup   => 'my $r = bless []',
+        code    => '!ref $r',
+    },
+
+    'func::ref::notaref' => {
+        desc    => 'ref($notaref) in scalar context',
+        setup   => 'my $x; my $r = "boo"',
+        code    => '$x = ref $r',
+    },
+    'func::ref::ref' => {
+        desc    => 'ref($ref) in scalar context',
+        setup   => 'my $x; my $r = []',
+        code    => '$x = ref $r',
+    },
+    'func::ref::blessedref' => {
+        desc    => 'ref($blessed_ref) in scalar context',
+        setup   => 'my $x; my $r = bless []',
+        code    => '$x = ref $r',
+    },
+
+
+
+    'func::sort::num' => {
+        desc    => 'plain numeric sort',
+        setup   => 'my (@a, @b); @a = reverse 1..10;',
+        code    => '@b = sort { $a <=> $b } @a',
+    },
+    'func::sort::num_block' => {
+        desc    => 'codeblock numeric sort',
+        setup   => 'my (@a, @b); @a = reverse 1..10;',
+        code    => '@b = sort { $a + 1 <=> $b + 1 } @a',
+    },
+    'func::sort::num_fn' => {
+        desc    => 'function numeric sort',
+        setup   => 'sub f { $a + 1 <=> $b + 1 } my (@a, @b); @a = reverse 1..10;',
+        code    => '@b = sort f @a',
+    },
+    'func::sort::str' => {
+        desc    => 'plain string sort',
+        setup   => 'my (@a, @b); @a = reverse "a".."j";',
+        code    => '@b = sort { $a cmp $b } @a',
+    },
+    'func::sort::str_block' => {
+        desc    => 'codeblock string sort',
+        setup   => 'my (@a, @b); @a = reverse "a".."j";',
+        code    => '@b = sort { ($a . "") cmp ($b . "") } @a',
+    },
+    'func::sort::str_fn' => {
+        desc    => 'function string sort',
+        setup   => 'sub f { ($a . "") cmp ($b . "") } my (@a, @b); @a = reverse  "a".."j";',
+        code    => '@b = sort f @a',
+    },
+
+    'func::sort::num_inplace' => {
+        desc    => 'plain numeric sort in-place',
+        setup   => 'my @a = reverse 1..10;',
+        code    => '@a = sort { $a <=> $b } @a',
+    },
+    'func::sort::num_block_inplace' => {
+        desc    => 'codeblock numeric sort in-place',
+        setup   => 'my @a = reverse 1..10;',
+        code    => '@a = sort { $a + 1 <=> $b + 1 } @a',
+    },
+    'func::sort::num_fn_inplace' => {
+        desc    => 'function numeric sort in-place',
+        setup   => 'sub f { $a + 1 <=> $b + 1 } my @a = reverse 1..10;',
+        code    => '@a = sort f @a',
+    },
+    'func::sort::str_inplace' => {
+        desc    => 'plain string sort in-place',
+        setup   => 'my @a = reverse "a".."j";',
+        code    => '@a = sort { $a cmp $b } @a',
+    },
+    'func::sort::str_block_inplace' => {
+        desc    => 'codeblock string sort in-place',
+        setup   => 'my @a = reverse "a".."j";',
+        code    => '@a = sort { ($a . "") cmp ($b . "") } @a',
+    },
+    'func::sort::str_fn_inplace' => {
+        desc    => 'function string sort in-place',
+        setup   => 'sub f { ($a . "") cmp ($b . "") } my @a = reverse  "a".."j";',
+        code    => '@a = sort f @a',
+    },
+
+
+    'func::split::vars' => {
+        desc    => 'split into two lexical vars',
+        setup   => 'my $s = "abc:def";',
+        code    => 'my ($x, $y) = split /:/, $s, 2;',
+    },
+
+    'func::split::array' => {
+        desc    => 'split into a lexical array',
+        setup   => 'my @a; my $s = "abc:def";',
+        code    => '@a = split /:/, $s, 2;',
+    },
+    'func::split::myarray' => {
+        desc    => 'split into a lexical array declared in the assign',
+        setup   => 'my $s = "abc:def";',
+        code    => 'my @a = split /:/, $s, 2;',
+    },
+    'func::split::arrayexpr' => {
+        desc    => 'split into an @{$expr} ',
+        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);',
+    },
+
+
+    'func::sprintf::d' => {
+        desc    => '%d',
+        setup   => 'my $s; my $a1 = 1234;',
+        code    => '$s = sprintf "%d", $a1',
+    },
+    'func::sprintf::d8' => {
+        desc    => '%8d',
+        setup   => 'my $s; my $a1 = 1234;',
+        code    => '$s = sprintf "%8d", $a1',
+    },
+    'func::sprintf::foo_d8' => {
+        desc    => 'foo=%8d',
+        setup   => 'my $s; my $a1 = 1234;',
+        code    => '$s = sprintf "foo=%8d", $a1',
+    },
+
+    'func::sprintf::f0' => {
+        # "%.0f" is very special-cased
+        desc    => 'sprintf "%.0f"',
+        setup   => 'my $s; my $a1 = 123.456;',
+        code    => '$s = sprintf "%.0f", $a1',
+    },
+    'func::sprintf::foo_f0' => {
+        # "...%.0f..." is special-cased
+        desc    => 'sprintf "foo=%.0f"',
+        setup   => 'my $s; my $a1 = 123.456;',
+        code    => '$s = sprintf "foo=%.0f\n", $a1',
+    },
+    'func::sprintf::foo_f93' => {
+        desc    => 'foo=%9.3f',
+        setup   => 'my $s; my $a1 = 123.456;',
+        code    => '$s = sprintf "foo=%9.3f\n", $a1',
+    },
+
+    'func::sprintf::g9' => {
+        # "...%.NNNg..." is special-cased
+        desc    => '%.9g',
+        setup   => 'my $s; my $a1 = 123.456;',
+        code    => '$s = sprintf "%.9g", $a1',
+    },
+    'func::sprintf::foo_g9' => {
+        # "...%.NNNg..." is special-cased
+        desc    => 'foo=%.9g',
+        setup   => 'my $s; my $a1 = 123.456;',
+        code    => '$s = sprintf "foo=%.9g\n", $a1',
+    },
+    'func::sprintf::foo_g93' => {
+        desc    => 'foo=%9.3g',
+        setup   => 'my $s; my $a1 = 123.456;',
+        code    => '$s = sprintf "foo=%9.3g\n", $a1',
+    },
+
+    'func::sprintf::s' => {
+        desc    => '%s',
+        setup   => 'my $s; my $a1 = "abcd";',
+        code    => '$s = sprintf "%s", $a1',
+    },
+    'func::sprintf::foo_s' => {
+        desc    => 'foo=%s',
+        setup   => 'my $s; my $a1 = "abcd";',
+        code    => '$s = sprintf "foo=%s", $a1',
+    },
+    'func::sprintf::mixed_utf8_sss' => {
+        desc    => 'foo=%s bar=%s baz=%s',
+        setup   => 'my $s;my $a = "ab\x{100}cd"; my $b = "efg"; my $c = "h\x{101}ij"',
+        code    => '$s = sprintf "foo=%s bar=%s baz=%s", $a, $b, $c',
+    },
+
+    'func::subst::bool' => {
+        desc    => 's/// in boolean context',
+        setup   => '',
+        code    => '$_ = "aaa"; !s/./x/g;'
+    },
+
+
+    'func::values::scalar_cxt_empty' => {
+        desc    => ' values() on an empty hash in scalar context',
+        setup   => 'my $k; my %h = ()',
+        code    => '$k = values %h',
+    },
+    'func::values::scalar_cxt' => {
+        desc    => ' values() on a non-empty hash in scalar context',
+        setup   => 'my $k; my %h = qw(aardvark 1 banana 2 cucumber 3)',
+        code    => '$k = values %h',
+    },
+    'func::values::list_cxt_empty' => {
+        desc    => ' values() on an empty hash in list context',
+        setup   => 'my %h = ()',
+        code    => '() = values %h',
+    },
+    'func::values::list_cxt' => {
+        desc    => ' values() on a non-empty hash in list context',
+        setup   => 'my %h = qw(aardvark 1 banana 2 cucumber 3)',
+        code    => '() = values %h',
+    },
+
+
+
+    'loop::block' => {
+        desc    => 'empty basic loop',
+        setup   => '',
+        code    => '{1;}',
+    },
+
+    'loop::do' => {
+        desc    => 'basic do block',
+        setup   => 'my $x; my $y = 2;',
+        code    => '$x = do {1; $y}', # the ';' stops the do being optimised
+    },
+
+    'loop::for::my_range1' => {
+        desc    => 'empty for loop with my var and 1 integer range',
+        setup   => '',
+        code    => 'for my $x (1..1) {}',
+    },
+    'loop::for::lex_range1' => {
+        desc    => 'empty for loop with lexical var and 1 integer range',
+        setup   => 'my $x;',
+        code    => 'for $x (1..1) {}',
+    },
+    'loop::for::pkg_range1' => {
+        desc    => 'empty for loop with package var and 1 integer range',
+        setup   => '$x = 1;',
+        code    => 'for $x (1..1) {}',
+    },
+    'loop::for::defsv_range1' => {
+        desc    => 'empty for loop with $_ and integer 1 range',
+        setup   => ';',
+        code    => 'for (1..1) {}',
+    },
+    'loop::for::my_range4' => {
+        desc    => 'empty for loop with my var and 4 integer range',
+        setup   => '',
+        code    => 'for my $x (1..4) {}',
+    },
+    'loop::for::lex_range4' => {
+        desc    => 'empty for loop with lexical var and 4 integer range',
+        setup   => 'my $x;',
+        code    => 'for $x (1..4) {}',
+    },
+    'loop::for::pkg_range4' => {
+        desc    => 'empty for loop with package var and 4 integer range',
+        setup   => '$x = 1;',
+        code    => 'for $x (1..4) {}',
+    },
+    'loop::for::defsv_range4' => {
+        desc    => 'empty for loop with $_ and integer 4 range',
+        setup   => ';',
+        code    => 'for (1..4) {}',
+    },
+
+    'loop::for::my_list1' => {
+        desc    => 'empty for loop with my var and 1 integer list',
+        setup   => '',
+        code    => 'for my $x (1) {}',
+    },
+    'loop::for::lex_list1' => {
+        desc    => 'empty for loop with lexical var and 1 integer list',
+        setup   => 'my $x;',
+        code    => 'for $x (1) {}',
+    },
+    'loop::for::pkg_list1' => {
+        desc    => 'empty for loop with package var and 1 integer list',
+        setup   => '$x = 1;',
+        code    => 'for $x (1) {}',
+    },
+    'loop::for::defsv_list1' => {
+        desc    => 'empty for loop with $_ and integer 1 list',
+        setup   => ';',
+        code    => 'for (1) {}',
+    },
+    'loop::for::my_list4' => {
+        desc    => 'empty for loop with my var and 4 integer list',
+        setup   => '',
+        code    => 'for my $x (1,2,3,4) {}',
+    },
+    'loop::for::lex_list4' => {
+        desc    => 'empty for loop with lexical var and 4 integer list',
+        setup   => 'my $x;',
+        code    => 'for $x (1,2,3,4) {}',
+    },
+    'loop::for::pkg_list4' => {
+        desc    => 'empty for loop with package var and 4 integer list',
+        setup   => '$x = 1;',
+        code    => 'for $x (1,2,3,4) {}',
+    },
+    'loop::for::defsv_list4' => {
+        desc    => 'empty for loop with $_ and integer 4 list',
+        setup   => '',
+        code    => 'for (1,2,3,4) {}',
+    },
+
+    'loop::for::my_array1' => {
+        desc    => 'empty for loop with my var and 1 integer array',
+        setup   => 'my @a = (1);',
+        code    => 'for my $x (@a) {}',
+    },
+    'loop::for::lex_array1' => {
+        desc    => 'empty for loop with lexical var and 1 integer array',
+        setup   => 'my $x; my @a = (1);',
+        code    => 'for $x (@a) {}',
+    },
+    'loop::for::pkg_array1' => {
+        desc    => 'empty for loop with package var and 1 integer array',
+        setup   => '$x = 1; my @a = (1);',
+        code    => 'for $x (@a) {}',
+    },
+    'loop::for::defsv_array1' => {
+        desc    => 'empty for loop with $_ and integer 1 array',
+        setup   => 'my @a = (@a);',
+        code    => 'for (1) {}',
+    },
+    'loop::for::my_array4' => {
+        desc    => 'empty for loop with my var and 4 integer array',
+        setup   => 'my @a = (1..4);',
+        code    => 'for my $x (@a) {}',
+    },
+    'loop::for::lex_array4' => {
+        desc    => 'empty for loop with lexical var and 4 integer array',
+        setup   => 'my $x; my @a = (1..4);',
+        code    => 'for $x (@a) {}',
+    },
+    'loop::for::pkg_array4' => {
+        desc    => 'empty for loop with package var and 4 integer array',
+        setup   => '$x = 1; my @a = (1..4);',
+        code    => 'for $x (@a) {}',
+    },
+    'loop::for::defsv_array4' => {
+        desc    => 'empty for loop with $_ and integer 4 array',
+        setup   => 'my @a = (1..4);',
+        code    => 'for (@a) {}',
+    },
+
+    'loop::for::next4' => {
+        desc    => 'for loop containing only next with my var and integer 4 array',
+        setup   => 'my @a = (1..4);',
+        code    => 'for my $x (@a) {next}',
+    },
+
+    'loop::grep::expr_3int' => {
+        desc    => 'grep $_ > 0, 1,2,3',
+        setup   => 'my @a',
+        code    => '@a = grep $_ > 0, 1,2,3',
+    },
+
+    'loop::grep::block_3int' => {
+        desc    => 'grep { 1; $_ > 0} 1,2,3',
+        setup   => 'my @a',
+        code    => '@a = grep { 1; $_ > 0} 1,2,3',
+    },
+
+    'loop::map::expr_3int' => {
+        desc    => 'map $_+1, 1,2,3',
+        setup   => 'my @a',
+        code    => '@a = map $_+1, 1,2,3',
+    },
+
+    'loop::map::block_3int' => {
+        desc    => 'map { 1; $_+1} 1,2,3',
+        setup   => 'my @a',
+        code    => '@a = map { 1; $_+1} 1,2,3',
+    },
+
+    'loop::while::i1' => {
+        desc    => 'empty while loop 1 iteration',
+        setup   => 'my $i = 0;',
+        code    => 'while (++$i % 2) {}',
+    },
+    'loop::while::i4' => {
+        desc    => 'empty while loop 4 iterations',
+        setup   => 'my $i = 0;',
+        code    => 'while (++$i % 4) {}',
+    },
+
+
+    'regex::anyof_plus::anchored' => {
+        setup   => '$_ = "a" x 100;',
+        code    => '/^[acgt]+/',
+    },
+    'regex::anyof_plus::floating' => {
+        desc    => '/[acgt]+where match starts at position 0 for 100 chars/',
+        setup   => '$_ = "a" x 100;',
+        code    => '/[acgt]+/',
+    },
+    'regex::anyof_plus::floating_away' => {
+        desc    => '/[acgt]+/ where match starts at position 100 for 100 chars',
+        setup   => '$_ = ("0" x 100) . ("a" x 100);',
+        code    => '/[acgt]+/',
+    },
+
+    'regex::whilem::min_captures_fail' => {
+        desc    => '/WHILEM with anon-greedy match and captures that fails',
+        setup   => '$_ = ("a" x 20)',
+        code    => '/^(?:(.)(.))*?[XY]/',
+    },
+    'regex::whilem::max_captures_fail' => {
+        desc    => '/WHILEM with a greedy match and captures that fails',
+        setup   => '$_ = ("a" x 20)',
+        code    => '/^(?:(.)(.))*[XY]/',
+    },
 ];