Help me choose a C++ compiler to work with Python
John J. Lee
jjl at pobox.com
Sun Sep 21 22:50:57 CEST 2003
rh4170056 at juno.com (rhmd) writes:
> I would like to use it for various applications, but the
> mathematical calculations are way too slow (a million sines 8 seconds
> in Python vs. 2 seconds in Excel VBA), so was thinking of learning
> enough C++ to do the number crunching in C++ and integrating the C++
> routines with Python. My question:
Do remember that frequently only small parts of your code (even the
number crunching part) are responsible for most of the running time.
Writing everything in Python then porting the 'hot spots' is often the
best strategy. Use the profiler.
Also (apart from Numeric / numarray), remember (or discover) Pyrex and
psyco. Probably Pyrex is more useful to you than psyco. Don't apply
either to your whole program. Just pick the bottlenecks.
Quite a few people here have touted O'Caml as a replacement for C++
for this kind of thing. C is worth considering, too, especially if
you find the parts you need to move down to a lower-level language are
If you insist on using C++, make sure to look at Boost.Python
More information about the Python-list