-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
__debug__ flag slows down image message creation #79
Comments
The check of the data types of each element in the sequence is relevant to prevent putting invalid data into the message. As of Dashing a rosidl_python/rosidl_generator_py/resource/_msg.py.em Lines 425 to 433 in 50afb33
Therefore I think the function See ros-perception/vision_opencv#305 for the proposed fix which updates |
Addressed by the referenced PR. |
Bug report
Required Info:
Steps to reproduce issue
Expected behavior
Actual behavior
Additional information
I experienced a slow performance during a
cv2_to_imgmsg
call. The interesting part is, that the call in C++ is fast. Probably it has to do something with the python message wrapper. Did someone experienced also a slow down withcv2_to_imgmsg
calls?Right now a 1080x1920x3 image takes up 1.4s to convert to a ROS2 image message.
The slow down is happening at this line: https://github.com/ros-perception/vision_opencv/blob/ros2/cv_bridge/python/cv_bridge/core.py#L275
and the root cause is at this line: https://github.com/ros2/rosidl_python/blob/master/rosidl_generator_py/resource/_msg.py.em#L481
Feature request
Deactivate the per-element comparison for images or use another approach then the
__debug__
flag from python. This flag is always on and can be only set to false with PYTHONOPTIMIZE={1|2} (for ROS2) or for python (-O) (-OO). Did not found a documentation for this behavior in the ROS2 documentation. With this flag the__debug__
field is going to be false and everything is running smoothly.The text was updated successfully, but these errors were encountered: