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

2009-09-11 Thread David Roy

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()
geom_utils.AddTangentAndBinormal()

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

- I'm allocating about 1 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...

Thanks
-David


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
> [email protected]
> http://mail.python.org/mailman/listinfo/cplusplus-sig
> 
> 

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

___
Cplusplus-sig mailing list
[email protected]
http://mail.python.org/mailman/listinfo/cplusplus-sig


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

2009-09-11 Thread Nicolas Lelong

David wrote:

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


That may be dumb, but are you sure that you reset your global data 
structures before or after your free function call. When using the class 
approach, your cleanup is automatic, but you may have forgotten something 
when switching to globals.


troy wrote:

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.


FWIW, I also don't have any performance problems when using free functions, 
and I'd tend to agree with troy.


___
Cplusplus-sig mailing list
[email protected]
http://mail.python.org/mailman/listinfo/cplusplus-sig


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

2009-09-11 Thread troy d. straszheim

David Roy wrote:


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



Not really.  Without runnable examples we'd just be guessing.

-t
___
Cplusplus-sig mailing list
[email protected]
http://mail.python.org/mailman/listinfo/cplusplus-sig