Assistance sought with mondo numerical app

D. Michael McFarland dmmcf at uiuc.edu
Mon Apr 15 15:55:28 EDT 2002


Fernando Pérez <fperez528 at yahoo.com> writes:

> Have you looked at the possibility of rewriting some of the tight
> inner loops in C? These days using weave (http://scipy.org/) it's
> perfectly reasonable to get large speedups with very little work. I
> don't know your code so I don't know how realistic this is (and you
> guys seem to be under tight deadlines), but you can look at this
> pdf: http://www-hep.colorado.edu/~fperez/python_misc/python-c.pdf
> for a simple example where the speedup is a factor of 25.

I've looked at doing something like this, but in the end elected not
to because I'm afraid of introducing subtle bugs into something we've
developed some confidence in.

I have profiled the Python code pretty carefully, and was able to
achieve a reduction in run time of a little better than 50% compared
to my first, naive implementation.  The bottlenecks now seem to be in
memory management, which I'm sure Python does better than I would in
C, and numerical linear algebra, which I'm sure Numeric does better
than I would.

Once I understand Weave and friends better, and the stakes are a
little lower, I'll try that approach.  For now, though, the safest
route seems to be to throw CPU time at the existing code.

Thanks for your interest and the pointer.

Cheers,
Michael



More information about the Python-list mailing list