in reply to Re: how can I speed up this perl??
in thread how can I speed up this perl??
Some genome sequence share a counter. I mapped each genome sequence to the reference of the update counter, so there is some dereferencing.
Chris
#!/usr/bin/perl use strict; use warnings; my @genome = ('a', 'a'); my $i = 0; my @seq = qw/ aa ag ac at ta tg tc tt ca cg cc ct ga gg gc gt /; my ($tt, $ag, $ac, $at, $ta, $tg, $ga, $cg, $cc, $gc) = (0) x 10; my %counter; @counter{@seq} = \($tt, $ag, $ac, $at, $ta, $tg, $ga, $tt, $tg, $cg, $cc, $ag, $ga, $cc, $gc, $ac); + if (exists $counter{ $genome[$i] . $genome[$i+1] }) { + ++${ $counter{ $genome[$i] . $genome[$i+1] }} }
|
|---|