Benchmark-Perl-Formance
view release on metacpan or search on metacpan
lib/Benchmark/Perl/Formance/Plugin/RxCmp.pm view on Meta::CPAN
# LPEG regexes seemingly don't work the same way as usual regexes
# therefore the pattern below does not match.
# TODO: Find a equivalent pattern.
eval "use re::engine::LPEG"; ## no critic
if ($@) {
print STDERR "# ".$@ if $options->{verbose} > 2;
return { failed => "use failed" };
}
return { not_yet_implemented => 'missing comparable equivalent regex' };
my $result;
my $re_local = ("'a'?" x $n) . ("'a'" x $n);
#my $reg = qr/$re_local/; # using that $reg later segfaults
my $t = timeit $count, sub { $result = $string =~ /$re_local/ };
return {
Benchmark => $t,
goal => $goal,
count => $count,
result => $result,
lib/Benchmark/Perl/Formance/Plugin/RxCmp.pm view on Meta::CPAN
};
}
sub Lua
{
my ($options) = @_;
# LPEG regexes seemingly don't work the same way as usual regexes
# therefore the pattern below does not match.
# TODO: Find a equivalent pattern.
# return { not_yet_implemented => 'need to find a equivalent pattern' };
eval "use re::engine::Lua"; ## no critic
if ($@) {
print STDERR "# ".$@ if $options->{verbose} > 2;
return { failed => "use failed" };
}
my $result;
#my $reg = qr/$re/; # using that $reg later segfaults, unfortunately that makes
my $t = timeit $count, sub { $result = $string =~ /$re/ };
( run in 0.321 second using v1.01-cache-2.11-cpan-4d4bc49f3ae )