py26-numpy is much slower than NumPy compiled for MacPython

Ned Deily nad at acm.org
Tue Dec 7 15:46:51 PST 2010


In article <E47D0C1D-F72C-4A18-A0DC-0062B95F46FA at fastmail.net>,
 Konrad Hinsen <konrad.hinsen at fastmail.net> wrote:

> 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?

Could it be 64-bit vs 32-bit?  The python 2.6 from a python.org 
installer (I assume that's what you mean by MacPython) is built as 
32-bit only.  If you build python 2.6 with MacPorts it will likely be 
64-bit by default on OS X 10.6.  You might try asking on the numpy 
mailing list as people there are more likely to have experience with the 
performance trade-offs:

http://dir.gmane.org/gmane.comp.python.numeric.general

-- 
 Ned Deily,
 nad at acm.org



More information about the macports-users mailing list