[C++-sig] new to python; old to C++

Thomas Berg merlin66b at gmail.com
Sun Nov 2 15:12:12 CET 2008


On Sun, Nov 2, 2008 at 2:11 PM, David Abrahams <dave at boostpro.com> wrote:
>
> on Sat Nov 01 2008, Paul Melis <paul-AT-pecm.nl> wrote:
>
>> Gustavo Carneiro wrote:
>>>
>>>     There's an interesting question about whether it's better to use
>>>     boost.python or SWIG. I've been using boost.python for years, so I
>>>     have a lot invested in it, but if I were starting from scratch, I
>>>     might consider using SWIG because it gives you the flexibility to
>>>     generate wrappers for languages other than Python.
>>>
>>>
>>> On the other hand, SWIG generates ugly and inneficient code, at least
>>> for the Python case.
>> I'd like to see proof of the claim that SWIG's wrapper code is
>> inefficient. In my experience it is not more inefficient than what, for
>> example, boost.python via Py++ provides.
>
> I doubt that SWIG generates less efficient code.  However, I would be
> surprised if SWIG's is as careful about dealing with lifetime and
> ownership issues that are crucial to writing Pythonic and un-crashable
> bindings as Boost.Python is.
>
> --
> Dave Abrahams
> BoostPro Computing
> http://www.boostpro.com
> _______________________________________________
> Cplusplus-sig mailing list
> Cplusplus-sig at python.org
> http://mail.python.org/mailman/listinfo/cplusplus-sig
>


At the Europython 2004 conference, there was a talk with the topic
"Python Wrapper Tools: A Performance Study". I'm unable to find the
pdf online now, it used to be located here:
http://people.web.psi.ch/geus/talks/europython2004_geus.pdf

It contains results from benchmarking wrapped calls with the different
tools. Things may have changed now, of course, but SWIG was found to
have larger overhead than the other alternatives. Also, SIP was found
to be faster than boost python. I still have the pdf if anyone is
interested.


Thomas


More information about the Cplusplus-sig mailing list