blog page - 1/1 Blog
blog page - 1/1¶
Mixing pybind11 modules¶
My scenario was the following: expose a C++ class in one C++ module exported with pybind11, then create a function in a another C++ module returning a result of this class. The solution for that is described in the following issue Return type that is implemented in another library with another set of python bindings, which links to this part of the documentation Custom type casters. and implemented in this module somewhere in cbenchmark_dot.cpp.
I wanted to test some facts described in the following blog post: Why is it faster to process a sorted array than an unsorted array?. I ended it writing this notebook Measures branching in C++ from python which compares a couple of implementations of the same computation, a dot product.
Cython, Pythran, nuitka, numba¶
I discovered than :epkg:`Pythran` was now a possible backend for Cython: Pythran as a Numpy backend. On one benchmark, it increases the speed by 2. I recommend the reading of the following article: Optimizing your code with NumPy, Cython, pythran and numba which instigates the performance brought by the four following tool and gives some hints on how to write efficient code with these tools:
Exploration with pybind11 and ExtensionArray¶
I tried the version of pybind11
to expose a dummy C++ object
to implement a couple of operators and to see
how it behaves into a dataframe.
Call C# from Python¶
A couple of questions must be answers to do that.