MATLAB2Python
Robert Kern
rkern at ucsd.edu
Thu Apr 29 17:30:57 EDT 2004
Sarge wrote:
>>I have found numerous cases where Python programs run 10-100
>>times slower or more than a comparable Fortran 95 program.
>
>
> Uh-oh. This is not fine.
> I want to switch to py in order to achieve more flexibility
> especially in the areas of GUIs, distributed computing, and oo-
> programming. But I don't want my programs run 100 times slower!
> Is it possible to integrate some fortran compiled routines in order
> to speed up the more time-consuming steps?
Why, yes! http://cens.ioc.ee/projects/f2py2e/
In my experience, the 10-100 factor only arises when you are doing all
the looping in Python. If you can utilize Numeric arrays sufficiently,
most of the looping goes down into fast C. So be wary of premature
optimization: sometimes the Python code will run just as fast or fast
enough (or faster!) than calling out to FORTRAN or C or C++.
> Thanx,
> Sarge
>
> P.S. I have already tried Fortran95 for a while, but I found it's a
> very old-fashioned language, more than Matlab itself, I didn't like
> it very much.
--
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