in reply to Performance Tuning: Searching Long-Sequence Permutations
$promoters_regex[0] = qr/[NT][GCATN][NG][NC][NG][NT][NG]/; $promoters_regex[1] = qr/[NG][NT][NG][NC][NG][GCATN][NT]/; $promoters_regex[2] = qr/[NA][GCATN][NC][NG][NC][NA][NC]/; $promoters_regex[3] = qr/[NC][NA][NC][NG][NC][GCATN][NA]/; ... $permutations_total++ while $string =~ $promoters_regex[$j];
You would also find it a bit faster if you could combine all the regexes into a big alternative regex, but then you couldn't match multiple promoters that overlap each other so that's probably gonna require lookaheads of some kind. Hm....
PS: Most of the time when you write a for loop with an index iterating through the elements of an array, you'd be better off with a foreach loop. This is one of those cases:
for (@promoters_regex) { $total++ while $string =~ $_; }
-- Chip Salzenberg, Free-Floating Agent of Chaos
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Performance Tuning: Searching Long-Sequence Permutations
by Abigail-II (Bishop) on Jun 26, 2003 at 23:37 UTC | |
by chip (Curate) on Jun 27, 2003 at 02:40 UTC | |
by diotalevi (Canon) on Jun 27, 2003 at 04:09 UTC | |
by Jasper (Chaplain) on Jun 27, 2003 at 13:17 UTC | |
by Abigail-II (Bishop) on Jun 27, 2003 at 13:23 UTC | |
by diotalevi (Canon) on Jun 27, 2003 at 13:25 UTC |