Use Pyrex instead (Re: newbie at SWIG, help needed with typemaps)

Francois Pinard pinard at iro.umontreal.ca
Mon Mar 31 15:02:28 CEST 2003


[achrist at easystreet.com]

> "Greg Ewing (using news.cis.dfn.de)" wrote:
> > This is exactly the sort of problem I designed Pyrex to solve.

> Looks almost too nice to be true.

This is the feeling you get out of Pyrex.  Extremely nice.

> Any reliability or performance issues?

You control how much performance you want.  It's rather simple, once
you are aware of where Pyrex chooses to use the Python API, and where
it chooses to not use it.  Looking at the generated C code, once in a
while, is instructive -- but you should be warned that this is not the
kind of code one would write "by hand".  Given you use proper algorithms
(of course), less often you use the Python API, more speed you get.

Best is probably to profile your application first, and use Pyrex mainly
to rewrite identified bottlenecks.

> Any reason to think this won't work with Windows and MSVC?

The C generated by Pyrex is rather generic and portable.  However, by
choice, Greg relies on the C compiler for a few kind of optimisations,
so if your compiler optimises poorly, it might make a slight difference
in performance.  I'm not really using Windows, but have the prejudice
(unverified) that Pyrex would work with MSVC if it is a sane compiler.

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard





More information about the Python-list mailing list