Distributed App - C++ with Python for Portability?
mnordhoff at mattnordhoff.com
Mon Mar 10 08:46:30 CET 2008
> After profiling their may be other ways to remove a bottleneck, such
> using existing highly-optimised libraries such as Numpy; Psycho, an
> optimising interpreter that can approach C type speeds for Python
> and you could create your own C++ based libraries.
> You might want to ask the Mercurial development team how they got
> impressive speed and functionality out of using mainly Python with
> critical regions in C. - Or watch this:
For what you do decide to rewrite in C, you can also use a language like
Cython  (which is a fork of Pyrex ). It looks mostly like Python,
and is translated to C without you having to write all of the
boilerplate Python C API stuff. Of course, not quite as efficient
well-tuned raw C, but much more pleasant to write.
(FWIW, Bazaar , another VCS written in Python similar to Mercurial,
has rewritten parts of two modules in Pyrex. Another one is in raw C,
because that's what was contributed.)
More information about the Python-list