ros2 / rmw_zenoh

RMW for ROS 2 using Zenoh as the middleware
Apache License 2.0
184 stars 34 forks source link

Combine the check and attach loops. #205

Closed clalancette closed 3 months ago

clalancette commented 3 months ago

This is mostly a performance optimization. We notice that we always attempt to detach the condition, regardless of whether we've attached it to begin with. We can use that to our advantage, in that during the initial iteration to check if something has triggered, we can also attach at the same time. This saves us from having to iterate over the wait set again later on. There is a downside here in that we may end up attaching things that we didn't need, but we also only do that up until something is ready. So this is probably a performance win in the usual cases.