jmmitc06 has asked for the wisdom of the Perl Monks concerning the following question:
I am a bioinformatics programmer and I am currently running a very large calculation looking for subgraph isomorphisms. I have optimized it to the best of my abilities (I'm limited to the scale of my rewriting since the underlying objects/modules are used in much of my other code)
Below is a subroutine that currently consumes 74% of the time in my multiday calculation, even when using a cluster with torque. I have tried various different things, but I cannot beat what I have and any improvement would save me considerable time.
sub equate2 { my ($self, $other, $mapping) = @_; foreach my $row_index (0..$#$mapping) { return 0 if (grep { $$self{Matrix}[$row_index][$_] != $$other{Matr +ix}[$$mapping[$row_index]][$$mapping[$_]]); } (0..$#$mapping)); } return 1; }
I can provide more information if necessary, but in short this subroutine finds if elements of two matrices, i and j determined by a vector: $mapping.
Any advice and any tips for improving performance would be greatly appreciated. I have tried switching out the grep and foreach with for statements to no avail.
Thanks to all the monks for the help you have given in the past.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Optimization Help
by choroba (Cardinal) on Aug 01, 2013 at 23:25 UTC | |
|
Re: Optimization Help
by BrowserUk (Patriarch) on Aug 01, 2013 at 23:24 UTC | |
by jmmitc06 (Beadle) on Aug 01, 2013 at 23:30 UTC | |
by jmmitc06 (Beadle) on Aug 01, 2013 at 23:33 UTC | |
by BrowserUk (Patriarch) on Aug 01, 2013 at 23:57 UTC | |
by jmmitc06 (Beadle) on Aug 02, 2013 at 05:07 UTC | |
by BrowserUk (Patriarch) on Aug 02, 2013 at 05:40 UTC | |
| |
by locked_user sundialsvc4 (Abbot) on Aug 02, 2013 at 12:39 UTC |