Distributed App - C++ with Python for Portability?

Matt Nordhoff mnordhoff at mattnordhoff.com
Mon Mar 10 03:46:30 EDT 2008


Paddy wrote:
> After profiling their may be other ways to remove a bottleneck, such
> as
> using existing highly-optimised libraries such as Numpy; Psycho, an
> optimising interpreter that can approach C type speeds for Python
> code;
> and you could create your own C++ based libraries.
> 
> You might want to ask the Mercurial development team how they got
> their
> impressive speed and functionality out of using mainly Python with
> critical regions in C. - Or watch this:
>   http://video.google.com/videoplay?docid=-7724296011317502612

For what you do decide to rewrite in C, you can also use a language like
Cython [1] (which is a fork of Pyrex [2]). 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 [3], 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.)

[1] <http://www.cython.org/>
[2] <http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/>
[3] <http://bazaar-vcs.org/>
-- 



More information about the Python-list mailing list