[C++-sig] Boost.Python: wrapping classes instead of functions???

David Roy david.roy.perso at gmail.com
Fri Sep 11 10:17:23 CEST 2009

Thanks for the reply.

Unfortunately I'm sure that it's the C++ code that's being called in both
cases (I put a pdb.set_trace() in the Python code that shouldn't be called
and a TRACE in the C++ code that should be called).

Some more information:
- there are 148 calls to the function AddTangentAndBinormal(), 0.00625 s per
call in the first case and 0.39 s per call in the second case).

- in the case of a class, the instance is not persisted, i.e. the following
python code is called 148 times:
geom_utils = GeomUtils()

- I'm using a std::map that will be filled with more than 10000 entries:
it's a private member of the class in the first case and a global in the
second case

- I'm allocating about 10000 vector3 of float each call

- I'm interacting with Panda3D game engine in this function

Don't know if some of these additional info is useful...


troy d. straszheim wrote:
> David Roy wrote:
>> and the profile was back to 54.0 seconds!!!
>> Please could someone help me understand what's the difference and the
>> mechanism underlying that?
> Probably that you're not running the code that you think you are.  There 
> should be no difference between member function and free function in 
> this case, unless you're not telling us something.  Run python with the 
> -v option to be sure that the code you are running comes from where you 
> expect it to.
> -t
> _______________________________________________
> Cplusplus-sig mailing list
> Cplusplus-sig at python.org
> http://mail.python.org/mailman/listinfo/cplusplus-sig

View this message in context: http://www.nabble.com/Boost.Python%3A-wrapping-classes-instead-of-functions----tp25380730p25396895.html
Sent from the Python - c++-sig mailing list archive at Nabble.com.

More information about the Cplusplus-sig mailing list