This message was sent from Geocrawler.com by "andrew x swan"
From: andrew x swan
python took this long:
362.25user 0.74system 6:09.78elapsed 98%CPU
and fortran took this long:
2.68user 1.12system 0:03.89elapsed 97%CPU
is this because the element by element calculations involved are contained in python for loops?
yes. david ascher
On Thu, 17 Feb 2000, andrew x swan wrote:
is this because the element by element calculations involved are contained in python for loops?
Hi Andrew!
I've only just begun using Numeric Python, but I'm a longtime user of GNU
Octave and a sporadic user of MatLab. In general, for loops kill the
execution speed of interpretive environments like Numpy and Octave.
The highspeed comes when one uses vector operations such as Matrix
multiplication.
If you can vectorize your code, meaning replace all the loops with matrix
operations, you should see equivalent speed to Fortran for large data
sets. As far as I know, you will never see an interpreted language match a
compiled one in the execution of for loops.
Thanks. Syrus.

============================
Syrus NematNasser
participants (3)

andrew x swan

David Ascher

Syrus NematNasser