No difference. I reran it, and it was never more than 3% in favour of either option.
Rate t_map_b t_map_e
t_map_b 28799/s -- -0%
t_map_e 28844/s 0% --
This is perl, v5.6.1 built for MSWin32-x86-multi-thread
use strict;
use warnings;
use Benchmark ();
sub t_map_b {
my $url = shift;
return map { "$url/$_\n" } @_;
}
sub t_map_e {
my $url = shift;
return map "$url/$_\n", @_;
}
my $url = 'http://www.domain.com/';
my @list = qw(
file0 file1 file2 file3 file4
file5 file6 file7 file8 file9
);
sub test {
my ($sub) = @_;
$a = join('', $sub->($url, @list));
}
Benchmark::cmpthese(-3, {
t_map_b => sub { test(\&t_map_b); },
t_map_e => sub { test(\&t_map_e); },
});
$a=$a;