Variant Effect Predictor (VEP) is a Genomics program for analyzing nucleotide mutations.
Full results are here.
sub subseq {
...
$data =~ s/\n//g;
$data =~ s/\r//g;
...
}
sub subseq {
...
$data =~ s/\n//g;
}
use Benchmark qw(cmpthese);
cmpthese($iterations, {
'orig' => sub { ... },
're_comp' => sub { ... },
'C' => sub { ... },
});
};
A full list ideas and benchmarks is here.
perl bench.pl
Rate re_comp orig C
re_comp 800/s -- -4% -87%
orig 835/s 4% -- -86%
C 5952/s 644% 613% --
Note: results are strongly influenced by input data.
my $nl = qr/\n/; my $cr = qr/\r/;
sub strip_crnl {
$_ = shift; s/$nl//g; s/$cr//g;
return $_;
}
eval q{
use Inline C => <<'END_OF_C_CODE';
char* strip_crnl(char* str) {
char *s;
char *s2 = str;
for (s = str; *s; *s++) {
if (*s != '\n' && *s != '\r') {
*s2++ = *s;
}
}
*s2 = '\0';
return str;
}
END_OF_C_CODE
};
Full results for modified program are here.
This change is now in Bio::Perl.
- slides: https://rocky.github.io/NYC-Perl-VEP/
- rocky@gnu.org