py26-numpy is much slower than NumPy compiled for MacPython

Frank Schima macsforever2000 at macports.org
Wed Dec 8 15:25:18 PST 2010


On Dec 8, 2010, at 9:28 AM, Eric A. Borisch wrote:

> == Executive summary ==
> The OS python has different numpy exception handling settings, and this is the reason for the performance difference.
> 
> == The brief results ==
> with numpy.seterr(all='ignore') -> 13s system, 12s macports
> with numpy.seterr(all='print') and numpy.seterr(under='ignore') -> 56s system, 46s macports
> 
> == The extended desription ==
> By adding the following after the imports to bench2.py:
> 
> old = numpy.seterr(all='ignore')
> print old
> 
> We get these results:
> 
> MacPro:Downloads$ /usr/bin/python  bench2.py
> {'over': 'ignore', 'divide': 'ignore', 'invalid': 'ignore', 'under': 'ignore'}
> CPU time: 13 s
> 
> MacPro:Downloads$ /opt/local/bin/python bench2.py
> {'over': 'print', 'divide': 'print', 'invalid': 'print', 'under': 'ignore'}
> CPU time: 12 s
> 
> Without the changes, the system python is still 13s, but the macports python is 46s. By setting the error handling on the system python to match the macports default (print, print, print, ignore) the system python takes 56s.
> 
> == Conclusion ==
> 
> I haven't looked at how or why these settings are different, but I believe this is the culprit.

Nice detective work. I can confirm that setting "numpy.seterr(all='ignore')" causes the benchmark to run at the faster time. 


Cheers!
Frank



More information about the macports-users mailing list