-
Hi, thanks for the great library! We have used pybind11 for quite a long time and one thing we notice that in pybind11, the performance of overload methods is decided by the location where it is defines, e.g. m.def("add", [](int a, int b) { return a + b; }, "a"_a, "b"_a);
m.def("add", [](const std::string& a, const std::string& b) { return a + b; }, "a"_a, "b"_a);
// reverse order
m.def("add1", [](const std::string& a, const std::string& b) { return a + b; }, "a"_a, "b"_a);
m.def("add1", [](int a, int b) { return a + b; }, "a"_a, "b"_a); The With nanobind11, it seems much much better, but we still observe similar degradation when compare the last one to the first one. So did nanobind11 use the similar mechanize, e.g. try the first one, if fail, then go to the next? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
In short: yes. Same mechanism, but much faster. |
Beta Was this translation helpful? Give feedback.
In short: yes. Same mechanism, but much faster.