use Benchmark qw(:all) ; use Perl6::Declare ('p'); sub normal_sub { my ($a, $b, $c, $d, $e) = @_; return [$a, $b, $c, $d, $e]; } sub normal_sub_hash { my %arg = @_; return [@arg{qw(a b c d e)}]; } sub normal_sub_hashref { my ($arg) = @_; return [@{$arg}{qw(a b c d e)}]; } sub6 sub6_sub ($a, $b, $c, $d, $e) { return [$a, $b, $c, $d, $e]; }; sub6 sub6_crazy ($a, $b, $c, $d, $e; is crazy) { warn "orzorz"; ___P6D_SIGSTART: return [$a, $b, $c, $d, $e]; }; sub call_sub6_crazy { sub6_crazy(p(a => 1, b => 2, c => 3, d => 4, e => 5)); } sub call_normal_sub { normal_sub_hash(a => 1, b => 2, c => 3, d => 4, e => 5); } sub call_normal_sub_hashref { normal_sub_hashref({a => 1, b => 2, c => 3, d => 4, e => 5}); } use constant mysub => \&normal_sub; sub call_normal_sub_slice { mysub->((1,2,3,4,5)[2,3,1,5,4]); } sub call_sub6_sub { sub6_sub(1,2,3,4,5); } sub call_nothing { } sub crazy_fake { my ($a, $b, $c, $d, $e); return [$a, $b, $c, $d, $e]; } #call_sub6_crazy(); use B::Concise qw(set_style add_callback); use B::Terse; B::Concise::compile(\&crazy_fake,\&sub6_crazy)->(); #B::Concise::compile('-exec','call_normal_sub_slice', 'call_sub6_crazy')->(); #__END__ # Use Perl code in strings... cmpthese(-2, { normal_sub => sub { call_normal_sub() }, normal_sub_hashref => sub { call_normal_sub_hashref() }, # sub6_sub => sub { call_sub6_sub() }, sub6_crazy => sub { call_sub6_crazy() }, sub_nothing => sub { call_nothing() }, });