Hi, I'm facing a very strange behavior that I cannot manage to explane. I'm currently working on a project of re-implementing Python functions in C++ in order to improve performance and I'm then creating Python extensions thanks to Boost. I implemented quite a heavy function that calculates tangents and binormals this way:
class GeomUtils { private: // some functions... public: AddTangentAndBinormals(); } GeomUtils::AddtangentAndBinormals() { // call some functions... } BOOST_PYTHON_MODULE(geom_utils) { class_<GeomUtils>("GeomUtils", init<>()) .def("AddTangentAndBinormals", &GeomUtils::AddTangentAndBinormals) ; } This was very successful, decreasing the computation time from 54.0 seconds to less than 1.0 second. Then I decided this wasn't worth a class and that I should directly export the function : AddTangentAndBinormals() { // call some functions... } BOOST_PYTHON_MODULE(geom_utils) { def("AddTangentAndBinormals", &AddTangentAndBinormals); } and the profile was back to 54.0 seconds!!! Please could someone help me understand what's the difference and the mechanism underlying that? Thanks -David -- View this message in context: http://www.nabble.com/Boost.Python%3A-wrapping-classes-instead-of-functions----tp25380730p25380730.html Sent from the Python - c++-sig mailing list archive at Nabble.com. _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig