Benchmark-Perl-Formance
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/Benchmark/Perl/Formance/Plugin/Shootout/knucleotide.pm view on Meta::CPAN
}
foreach my $s (qw(GGT GGTA GGTATT GGTATTTTAATT GGTATTTTAATTTATAGT)) {
update_hash_for_frame(length($s));
$output .= sprintf "%d\t$s\n", $h{$s};
}
print $output if $PRINT;
}
sub update_hash_for_frame {
my $frame = $_[0];
my @threads;
for my $i (0 .. $threads - 1) {
use integer;
my $begin = $l * $i / $threads;
my $end = $l * ($i + 1) / $threads - 1;
no integer;
if ($end > $l - $frame) {
$end = $l - $frame;
}
push @threads, threads->create(\&update_hash_slice, $frame, $begin, $end);
}
for my $thread (@threads) {
my $count = $thread->join;
$h{$_} += $count->{$_} for keys %$count;
}
}
sub update_hash_slice {
my ($frame, $begin, $end) = @_;
my %local;
$local{substr($sequence,$_,$frame)}++ for $begin .. $end;
return \%local;
}
sub num_cpus {
open my $fh, '<', '/proc/cpuinfo' or return;
my $cpus;
while (<$fh>) {
view all matches for this distributionview release on metacpan - search on metacpan
( run in 1.324 second using v1.00-cache-2.02-grep-82fe00e-cpan-4673cadbf75 )