[SciPy-User] help speeding up a Runge-Kuta algorithm (cython, f2py, ...)

Gael Varoquaux gael.varoquaux@normalesup....
Sun Aug 5 03:44:17 CDT 2012


On Sat, Aug 04, 2012 at 01:35:17PM -0600, Jonathan Stickel wrote:
> I am sure properly coded Cython is great, but I really struggled when I 
> tried to use it. I found that it allows you to write really slow code 
> without errors or warnings. I found the profiling tools to be only 
> marginally helpful.

To write fast cython code, compile it with 'cython -a', open the
resulting html file in a web browser. The yellow lines are where the
problems are: click on them and you'll find that they correspond to lines
of Cython code that lead to long and complex C code. Improve your code
(by making sure that it relies on typed variables and fast array access)
until it has not yellow lines.

HTH,

Gael


More information about the SciPy-User mailing list