py26-numpy is much slower than NumPy compiled for MacPython

Eric A. Borisch eborisch at macports.org
Wed Dec 8 08:28:11 PST 2010


== 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.

-Eric
-- 
Eric A. Borisch
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-users/attachments/20101208/99e4d65e/attachment.html>


More information about the macports-users mailing list