py26-numpy is much slower than NumPy compiled for MacPython

George Nurser gnurser at gmail.com
Wed Dec 8 04:54:11 PST 2010


I don't think it is a specifically Macports issue. On my (oldish)
 Macbook pro the system python & numpy with

 /usr/bin/python bench2.py takes 15 s

 while the 32/64 bit numpy I built took 52 s

 No difference between 32 and 64 bit (i.e.python-32 instead of python-64)

 Same ratio on my Mac Pro: 29s vs 10s.
 my numpy used flags in
 /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/config/Makefile
 OPT=            -DNDEBUG -g -O3
 BASECFLAGS=     -arch i386 -arch x86_64 -isysroot /  -fno-strict-aliasing
 -fno-common -dynamic
 LDFLAGS=        -arch i386 -arch x86_64 -isysroot / -g

 system numpy presumably uses flags from
 /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/config/Makefile
 OPT=            -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes
 EXTRA_CFLAGS=    -DENABLE_DTRACE
 BASECFLAGS=      -fno-strict-aliasing -fno-common -dynamic
 LDFLAGS=        -Wl,-F.

 --George.

>
> On 8 December 2010 07:21, Konrad Hinsen <konrad.hinsen at fastmail.net> wrote:
>> On 07.12.2010, at 21:58, 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
>>
>> Update: I profiled both runs using Shark, and found that when using the MacPorts version, 57% of the total time is spent in function feclearexcept. In the MacPython run, this function doesn't even show up. This makes me suspect that the difference is in the handling of floating point numbers, specifically floating-point exceptions.
>>
>> Konrad.
>>
>> _______________________________________________
>> macports-users mailing list
>> macports-users at lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macports-users
>>
>


More information about the macports-users mailing list