[C++-sig] Trouble optimizing Boost.python integration

Gustavo Carneiro gjcarneiro at gmail.com
Tue Sep 8 17:20:51 CEST 2009


2009/9/8 Stefan Seefeld <seefeld at sympatico.ca>

> On 09/08/2009 10:51 AM, Gustavo Carneiro wrote:
>
>> 2009/8/25 Dan Sanduleac <sanduleac.dan at gmail.com <mailto:
>> sanduleac.dan at gmail.com>>
>>
>>    Hi,
>>
>>    I'm trying to compare different python-C wrapping techniques to
>>    see which would be faster and also more suited to game development.
>>
>>
>> If your project does not use multiple inheritance, I may suggest you also
>> try with PyBindGen: http://code.google.com/p/pybindgen/
>>
>> Yes, me being the pybindgen author, I am biased, but still...  I am
>> curious to comparisons of pybindgen performance to other python wrapping
>> tools.
>>
>
> That's a strange line of argument. Didn't the original poster ask for
> advice ? It's your turn to do your homework and show why using PyBindGen is
> the better choice, instead of inviting people to use it and report back to
> you whether it was any good.
>

Hm.. but each person knows best the environment they work for.  It would be
presumptuous of me to tell him pybindgen is the better choice.

I don't have the full benchmarking setup, but here's how to wrap that
example (attached).  I had to add a default Vec3 constructor, since
pybindgen does not like very much classes without default constructors.

You generate the module with:

   python vec3-gen.py  > vec3module.cc

Compile with something like:

   g++ -O2 -fPIC -shared -I /usr/include/python2.6 vec3module.cc vec3.cpp -o
vec3.so

As for the benchmarking stuff, I leave to the original poster.

-- 
Gustavo J. A. M. Carneiro
INESC Porto, Telecommunications and Multimedia Unit
"The universe is always one step beyond logic." -- Frank Herbert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20090908/dfea3af4/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vec3-gen.py
Type: text/x-python
Size: 573 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20090908/dfea3af4/attachment.py>


More information about the Cplusplus-sig mailing list