speeding up Python script
Robert Kern
rkern at ucsd.edu
Wed May 18 08:39:23 EDT 2005
Luis P. Mendes wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> The reason why I'm using six nested for loops is because I need to find
> the best output using those six variables as input.
>
> Here's the simplified code:
>
> for per in range():
> ~ for s in range():
> ~ for t in range():
> for v in range():
> ~ for n in range():
> ~ for l in range():
What's the size of each dimension in the parameter space? If you
absolutely need an exhaustive search, then you are going to have to live
with the long runtimes. The fact that psyco didn't help significantly
suggests that Python optimizations aren't going to help much.
You should examine your problem and determine if you really need an
exhaustive search or if you can live with some other search strategy.
Read up on "combinatorial optimzation" and "discrete optimization."
--
Robert Kern
rkern at ucsd.edu
"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
More information about the Python-list
mailing list