Closed
Description
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
Metadata
Metadata
Assignees
Labels
No labels