4 ms·
Curious. Which overhead are you referring to for pybind11?
by nodemaker 4y ago
Curious. Which overhead are you referring to for pybind11?
- TkTech 4y agoIts magic function wrapping comes at a cost, trading ease of use for runtime performance. When you have a single C++ function to call that will run for a "long" time, pybind all the way. But pysimdjson tends to call a single function very quickly, and the overhead of a single function call is orders of magnitude slower than with cython when being explit with types and signatures. Wrap a class in pybind11 and cython and compare the stack trace between the two, and the difference is startling. Ex: https://github.com/TkTech/pysimdjson/issues/73 https://github.com/TkTech/pysimdjson/issues/73
- nodemaker 4y agoAh yeah that makes sense. I would rather call a single C++ function from Python that calls other C++ functions (or itself). In case of pysimdjson however, Cython makes much more sense. Overall this is way better than writing everything in Rust.