in reply to This runs WAY too slow
occasionally some of the results are just plain wrong.
Actually this is your problem No. 1. If the results are sometimes wrong, you can never trust the output. Which means that it doesn't matter how long it takes to get wrong results.
Note, I am using the recommendations from Perl Best Practices.
Surely not all of them. For example you declare way too many variables up front. And you're using many variables with similar names that really belong into a compound data structure (array or hash).
Here's my proposal on how to proceed:
One of your structural problems with both popnum1 and popnum2 is that it creates a full 2-dimensional array, and then returns a single element. I guess an effort can be made to short-circuit the calculation with knowledge of $x and $y.
There might also be a statistical model that can analytically predict some of the results, and thus avoid a whole lot of calculations, but so far I don't have the time to dig deeper into this.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: This runs WAY too slow
by Dandello (Monk) on Jan 16, 2011 at 15:30 UTC |