in reply to Re: how can I speed up this perl??
in thread how can I speed up this perl??
Even if you don't want to use a hash, you can still do:
which reduces the number of comparisons from max 20 to max 5.if ($genome [$i] eq 'a') { if ($genome [$i + 1] eq 'a') {$aa ++} elsif ($genome [$i + 1] eq 'c') {$ac ++} elsif ($genome [$i + 1] eq 'g') {$ag ++} elsif ($genome [$i + 1] eq 't') {$at ++} } elsif ($genome [$i] eq 'c') { if ($genome [$i + 1] eq 'a') {$ca ++} elsif ($genome [$i + 1] eq 'c') {$cc ++} ... etc ...
Abigail
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: how can I speed up this perl??
by pg (Canon) on Nov 24, 2003 at 17:07 UTC | |
by jbeninger (Monk) on Nov 24, 2003 at 19:07 UTC | |
by iburrell (Chaplain) on Nov 24, 2003 at 22:11 UTC |