Help me choose a C++ compiler to work with Python

rhmd rh4170056 at
Tue Sep 23 11:37:52 CEST 2003

Thanks to all who have responded.  Your information was very helpful,
I'm very impressed with the quality and thoughtfulness of the
responses.  Below find brief excerpts of some of the responses (which
I hope will be useful for others who search for info on this topic),
followed by more detail on my question.

  Have you considered and investigated Numeric Python or similar
  Look at the enthought Python installation (one is available for each
of 2.2 and 2.3) -- they not only install a slew of the packages you
might need for calculation heavy Python use, but (to support weave,
I believe), they also include a mingw32 compiler (minimal gnu win32)
which you can use for C++.  If you get to the point where you are
optimization-bound on your compiler (which you should determine by
measuring, not intuiting), you could do worse than the Intel compiler.
  I suggest you look at various Python libraries to do whatever
processing you might need to do. They are mostly written in C anyway
their performance is excellent. For instance, I use SciPy for Fourier
analysis and PIL for image processing, getting good performance on
numerically intensive tasks without ever leaving the ease and comfort
good old Python....The .NET compiler has a very good debugger and much
better standard compliance than the old 6.0 compiler, but I haven't
used  lot of different recent vintage C++ compilers...I generally use
COM objects written in Python to connect to Excel. I am very pleased
with that technique.

  Koenig & Moo's book (Accelerated C++) is the best I've
seen for [learning C++ for a few applications]..Python work with MSVC
is much less of a pain for most things than gcc (aka mingw).
  Writing everything in Python then porting the 'hot spots' is often
best strategy.  Use the profiler.
  Also (apart from Numeric / numarray), remember (or discover) Pyrex
psyco.  Probably Pyrex is more useful to you than psyco.  Don't apply
either to your whole program.  Just pick the bottlenecks.  If you
insist on using C++, make sure to look at Boost.Python(including
  gcc ... If you don't mind that it takes
forever to compile C++ source code, until version 3.4 is released (it
will support pre-compiled header).
  It is equally trivial to connect Python to Delphi using ctypes.
Delphi can easily make a DLL that looks to the outside world like
C.  I have found Delphi to be maybe a little bit slower than MS C,
but a little faster than gcc.  They are all pretty close on speed,
so you can't really pick a winner a priori.  If you are doing VBA
now, can't you buy the entry-level version of VB for around 100
bucks and create C-callable DLL's?

  VB.NET was another option I considered, have heard it produces
binary that runs "almost" as fast as that produced by C++, but am not
sure if that is true.  VB would be very convenient for me, but can it
produce DLLs that Python can use?  The reason I was considering using
Python/C++ combination is that I use Python already (as scripting
language for the Blender animation program) and thought I could also
use it with Excel to overcome certain Excel limitations, such as
Excel's ridiculous limitations on chart markers (i.e., could make
better charts with Python-- this would not be a time bottleneck so
Python's slowness is not an issue there), etc.  I also thought that,
despite Python's reputation for being a bit slow, it would at least be
faster than Excel VBA interpreter, but this may not be the case.  At
any rate, there are some calculations where I need a LOT of speed,
e.g. generating billions (with a B) of random numbers with the
Mersenne Twister algorithm (which is available in C++), for
statistical problems (mulitple undefined boundary conditions which can
only be extracted with a Monte Carlo method).  For this, even doubling
or quadrupling Python binary's speed would not be enough.

More information about the Python-list mailing list