Somewhat by accident I noticed an enormous speed difference in basic NumPy
operations between my MacPorts installation (py26-numpy) and the NumPy 1.5.1
binaries from the NumPy sourceforge site used with MacPython 2.6, also
downloaded as a binary.
~/projects/solar_system> /usr/local/bin/python bench2.py
CPU time: 16 s
~/projects/solar_system> /opt/local/bin/python bench2.py
CPU time: 45 s
The script bench2.py is attached. I wonder what could cause this big
difference. No BLAS operations are used, so the difference in BLAS
implementation should not matter. In fact, all that happens is allocation of a
big array and lots of float subtractions.
Did anyone look into this already?
Konrad.
import numpy
import time
def rij(p):
return p[:, numpy.newaxis, :] - p[numpy.newaxis, :, :]
p = numpy.zeros((50, 3), numpy.float)
start = time.clock()
for i in range(100000):
rij(p)
end = time.clock()
print "CPU time: %d s" % (end-start)
_______________________________________________
macports-users mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macports-users