[C++-sig] optimizing away calls to the python runtime -- was [detecting if a function is written in python or C++]

David Abrahams dave at boost-consulting.com
Tue Jan 17 17:41:56 CET 2006


Mathieu Lacage <Mathieu.Lacage at sophia.inria.fr> writes:

> My wrapped c++ code is not going to use boost::function but a similar
> template-based thing which will end up generating classes such as
> Callback1 in my example. 

Why reinvent the wheel?  boost::function will be more efficient,
better tested, etc...

> The () operators of these classes will have a
> non-zero number of arguments and will have return values (the current
> sample code demonstrate no return value but it should be extended to
> this case easily).
>
> But, it is my impression that doing so from c++ would require calling
> into the python interpreter rather than access directly the c++ bound
> method. I want to access directly the c++ bound method from c++ which is
> the whole point of this testcase.
>
> updated testcase (reworked as per your requests):
> http://spoutnik.inria.fr/yans/releases/test-python.tar.gz

No, it still contains the use of methods, which AFAICT is not needed
in order to prove your point.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com




More information about the Cplusplus-sig mailing list