Adam Ginsburg wrote: > Much appreciated. I guess the various levels of yellow in the html > file indicate the slow lines? I tried getting rid of all of my numpy > calls in the loop by rewriting them as loops, but that hasn't improved > speed at all, and in fact appears to have become slower. Right now a > fortran (f2py) version goes ~75% faster and pure python goes ~25% > faster, so I must be doing something wrong.
Not necesarrily. If your Fortran code is only 2x faster than Python there's usually not much Cython can do. Cython is for the times when Fortran is 1000x-2000x faster than Python! Another way of putting it: Cython is able to speed up operations on single array elements only. If you have lots of full-array operations, there's really not that much to gain. Cython shouldn't be *slower*, so something is a little strange. Did you try it with Cython before adding *any* types? Was it the act of compiling it in Cython, or adding the types, which slowed it down? Replacing array operations with loops can definitely slow things down over a straight NumPy function call, especially if boundscheck/wraparound directives are not set. -- Dag Sverre _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
