py26-numpy is much slower than NumPy compiled for MacPython

Frank Schima macsforever2000 at macports.org
Tue Dec 7 15:31:53 PST 2010


On Dec 7, 2010, at 1:58 PM, Konrad Hinsen 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?
> 
> Konrad.
> 
> <bench2.py>

Wow, interesting result. I just ran the benchmark on my Mac Pro 2008 and got 44 s with py26-numpy. I rebuilt it just to take a look. I noticed it is using -O3 in the configure flags which is good, but it was using gcc-4.2 to build. I have the gcc44 variant selected and that is the default, so it's possible that is the problem but maybe I'm just misunderstanding the gcc4x variants. 


Cheers!
Frank




More information about the macports-users mailing list