Rate transliterate substitution
transliterate 1011345/s -- -49%
substitution 1969797/s 95% --
####
use Benchmark qw(:all);
$toto = 'this+is+my+text+and+here+is+more+and+more+this+is+my+text+and+here+is+more+and+more+this+is+my+text+and+here+is+more+and+more';
$count =-5;
$results = timethese($count,
{
'transliterate' => sub { $toto = 'this+is+my+text+and+here+is+more+and+more+this+is+my+text+and+here+is+more+and+more+this+is+my+text+and+here+is+more+and+more'; $toto =~tr/+/ /; },
'substitution' => sub { $toto = 'this+is+my+text+and+here+is+more+and+more+this+is+my+text+and+here+is+more+and+more+this+is+my+text+and+here+is+more+and+more'; $toto =~s/\+/ /g; },
},
'none'
);
cmpthese( $results ) ;
exit 0;
##
##
Rate substitution transliterate
substitution 73807/s -- -88%
transliterate 625256/s 747% --