Conversation
|
Code size comparison - very minimal increase, likely because this approach exposes more C functions and types to Python.
-rw-r--r-- 1 sloretz sloretz 45K Jan 7 17:47 install/rclpy/lib/python3.8/site-packages/rclpy/_rclpy_logging.cpython-38-x86_64-linux-gnu.so
-rw-r--r-- 1 sloretz sloretz 53K Jan 7 17:37 install/rclpy/lib/python3.8/site-packages/rclpy/_rclpy_logging.cpython-38-x86_64-linux-gnu.so |
|
CI again with two new commits + rebased ros2/ci#531 for flak8 workaround |
|
Related to the comment here, I think that if we use cffi for all our bindings ensuring that objects are destroyed in the correct order will be quite complicated. |
Yeah, making sure publishers are destroyed before nodes etc is more complicated than what can be done with Pybind11. CFFI offers essentially the same capability as pycapsule destructors, so it would be about the same complexity as it is now. Upstream thoughts on destruction order |
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
c2fc875 to
6c7c0b4
Compare
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
|
Closing; future work in #665 |
This is a prototype using the
python-cffito generate the CPython extension instead of writing it ourselves. This pull request replaces _rclpy_logging with it. This is an alternative to pybind11 and #652.CFFI works by giving it a definition file and a bit of extra C code with all the includes for those definitions, and asking it to generate a CPython extension. That extension is then compiled by CMake, and used in the Python code. In the case of _rclpy_logging it gets rid of all the manual CPython extension writing, and in the process moving all the logic that was in C into Python instead.
@cottsay @IanTheEngineer @azeey FYI