speeding things up with C++

bullockbefriending bard kinch1967 at gmail.com
Fri Jun 1 10:42:03 CEST 2007

> Are you sure you want an STL container? Since the primary operator
> here is Python, the extra benefits from the STL container over plain C
> arrays isn't as evident.
> Pyrex is a good way to write the interface between your C++ code and
> the Python code - it handles the refcounting and boilerplate for you -
> and perhaps for writing the algorithms as well, depending on how
> complicated and performance sensitive they are.

good point. while i bow to the genius of the folks who invented
template metaprogramming, the compiler error messages tend to be
profoundly depressing :). one way or the other, pyrex is something i
need to learn since i'm now completely enamoured with python and had
better develop an arsenal of tricks for the rare times when it's just
not fast enough.

> Also, using numeric/Numarray can be a very big win. It can potentially
> save you a fair amount of marshalling overhead.

as i understand it, this is so for applying the likes of matrix
operations, autocorrelations, FFTs, etc...where python essentially
provides scripting glue to some highly optimised C functions. i'm
assuming that the kind of algorithm i am looking at which involves
some set operations on list elements + copying between lists isn't
going to be helped so much by using numpy or similar.

More information about the Python-list mailing list