Rate String::LCSS String::LCSS_XS
String::LCSS 60.9/s -- -100%
String::LCSS_XS 84746/s 138966% --
####
String::LCSS version = 0.12
String::LCSS_XS version = 1.2
>>>the quick brown fox <<<
>>>the quick brown fox <<<
Rate LCSS_XS LCSS
LCSS_XS 195695/s -- -27%
LCSS 268817/s 37% --
####
use strict;
use warnings;
use Benchmark qw(cmpthese);
use String::LCSS qw();
use String::LCSS_XS qw();
use Memoize qw(memoize);
memoize('String::LCSS::lcss');
printf "String::LCSS version = %s\n", $String::LCSS::VERSION;
printf "String::LCSS_XS version = %s\n", $String::LCSS_XS::VERSION;
my $s = 'i pushed the lazy dog into a creek, the quick brown fox told me to';
my $t = 'the quick brown fox jumps over the lazy dog';
printf ">>>%s<<<\n", String::LCSS::lcss ($s, $t);
printf ">>>%s<<<\n", String::LCSS_XS::lcss($s, $t);
print "\n";
#cmpthese(100_000, { # w/out memoize
cmpthese(1_000_000, { # w/ memoize
LCSS => sub { my $lcss = String::LCSS::lcss ($s, $t); },
LCSS_XS => sub { my $lcss = String::LCSS_XS::lcss($s, $t); },
});