[SciPy-user] Performance Python with Weave article updated

Pearu Peterson pearu at cens.ioc.ee
Tue Sep 21 03:02:17 CDT 2004

Hi Prabhu,

On Sun, 19 Sep 2004, Prabhu Ramachandran wrote:

> Just to let you know that I've updated the article on weave compared
> with other options here:
>  http://www.scipy.org/documentation/weave/weaveperformance.html
> The examples now work with weave from SciPy-0.3.  I've also added a
> comparison with Psyco and Pyrex.  The tarball has also been updated
> and includes all the sources along with a trivial setup.py to build
> the f2py module and the Pyrex module.

I was a bit surprised on the bad performance in the fortran test case.
So, I took a closer look into laplace.py and found there a bug in
fortranTimeStep() method; the line

  u, err = flaplace.timestep(g.u, g.dx, g.dy)

should read

  g.u, err = flaplace.timestep(g.u, g.dx, g.dy)

With this corrected code the performace in fortran case increased two

$ python laplace.py 
Doing 100 iterations on a 500x500 grid
numeric took 5.06 seconds
blitz took 1.91 seconds
inline took 0.8 seconds
fastinline took 0.54 seconds
fortran took 0.59 seconds
pyrex took 0.44 seconds
slow (1 iteration) took 2.72 seconds
100 iterations should take about 272.000000 seconds
slow with Psyco (1 iteration) took 1.81 seconds
100 iterations should take about 181.000000 seconds


More information about the SciPy-user mailing list