use Benchmark;
$string = "The bitter end.\n";
$code{"chomp"} = 'chomp $string';
$code{"regex"} = '$string =~ s/\n$//';
timethese(10_000_000, \%code);
или timethese($count, {
'test1' => sub { foreach $cur_val (@arr){....}},
'test2' => sub { ....много кода... },
});
|