[Pythonmac-SIG] Universal binary installer

Graham Cummins gic at cns.montana.edu
Thu Mar 16 03:01:27 CET 2006


I recently downloaded Ronald Doussoren's universal binary installer  
for MacPython. This installed fine on my Macbook Pro, and the  
resulting python version was able to build most of my favorite  
extensions (except PyOpenGL, which I can't get to build on any Mac  
recently - I'll post a separate issue about that.).

I also compiled the source from the universal svn tree (revision 41).  
This required that I edit
Lib/distutils/unixccompiler.py as follows:

--- python/Lib/distutils/unixccompiler.py       (revision 41)
+++ python/Lib/distutils/unixccompiler.py       (working copy)
@@ -42,8 +42,11 @@
#     should just happily stuff them into the preprocessor/compiler/ 
linker
#     options and carry on.
+
def _darwin_compiler(compiler_so, cc_args):
      compiler_so = list(compiler_so)
+    stripArch=0
+    stripSysroot=0
      if os.uname()[2] < '8.':
          stripArch = stripSysroot = 1

This just clears up a bug where some variables can end up undefined  
if an if condition comes up false. After this modification, the  
source complied fine with --enable-framework. I didn't use --enable- 
universal-sdk, so I guess I compiled an Intel-only version of the  
framework. I then built some extensions for this version also.

My reason to comment here has to do with the relevant performance of  
the Universal vs locally compiled pythons. In particular, I make  
heavy use of numarray, so I have a standard benchmark that tests many  
of the most computation intensive numarray routines with a variety of  
different data types. According to this benchmark, I'm getting much  
(>3X) better performance out of the local version than out of the  
Universal one.

For both python frameworks, I built numarray 1.5.1 using the basic  
"python setup.py install" (starting with clean source). The  
benchmarks I got were (in seconds to completion) about 24 seconds for  
the Universal, and only 7.2 seconds for the locally compiled python.  
For comparison, the older PPC only MacPython 2.4.1, with numarray  
installed via the included package manager took 32.6 seconds.

The native code on the MacBook compares very well to other machines.  
Native code on my dual G5 takes 8.4 seconds on this task. The only  
machine I've seen that's as fast as this MacBook was an SGI Altix 330  
(Itanium 2), and even it wasn't any faster. This makes me pretty  
happy about the Intel Core Duo, but somewhat worried about Universal  
binaries (in general, but for python in particular) since the binary  
seems closer in performance to rosetta than to native code.




More information about the Pythonmac-SIG mailing list