We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pybind11 example: #include<pybind11/pybind11.h> namespace py = pybind11; int test(int t) { return t * t; } PYBIND11_MODULE(pybindexample, m) { m.def("testFunc", &test); } then export as .pyc
Python example: from pybindexample import testFunc def pytestFunc(arg): return arg * arg
final results: t1 = timeit.Timer('pytestFunc(10)', 'from main import pytestFunc') print t1.timeit() t1 = 0.07
t2 = timeit.Timer('testFunc(10)', 'from main import testFunc') print t2.timeit() t2 = 0.26
The text was updated successfully, but these errors were encountered:
This is a duplicate of #1227. Take a look there.
Sorry, something went wrong.
Thanks for answering this, @molpopgen!
I don't see a Boost.Python example, so I can't compare if pybind11 is slower.
No branches or pull requests
pybind11 example:
#include<pybind11/pybind11.h>
namespace py = pybind11;
int test(int t) {
return t * t;
}
PYBIND11_MODULE(pybindexample, m) {
m.def("testFunc", &test);
}
then export as .pyc
Python example:
from pybindexample import testFunc
def pytestFunc(arg):
return arg * arg
final results:
t1 = timeit.Timer('pytestFunc(10)', 'from main import pytestFunc')
print t1.timeit()
t1 = 0.07
t2 = timeit.Timer('testFunc(10)', 'from main import testFunc')
print t2.timeit()
t2 = 0.26
The text was updated successfully, but these errors were encountered: