Poor CPU performance with Type Adapters when using references
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 805
- Forks
- 564
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 27
Description
Bug report
Required Info:
- Operating System:
- Ubuntu Jammy 22.04
- Installation type:
- Source
- Version or commit hash:
- rclcpp 21.1.0
- DDS implementation:
- fastdds or cyclone
- Client library (if applicable):
- rclcpp
Steps to reproduce issue
It appears when publishers move + publish a Message<T> and subscription callbacks have a signature of std::function<void(const<MessageT& msg)> , the CPU load is a lot higher compared to when dealing with shared_ptr<Message<T>> or unique_ptr<Message<T>>
From my experience the CPU load for the former is almost an order of magnitude greater.
I've setup a package here with minimal reproducible code.
It appears the Intraprocess manager might not be handing moved references properly.
Expected behavior
CPU load is the same for 1 pub + 1 sub.
Actual behavior
Additional information
Feature request
Feature description
Implementation considerations
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the minimal reproducer in the linked type_adapt_example package and comparing moved Message publishing with shared_ptr<Message> and unique_ptr<Message> callbacks. Read the rclcpp Intraprocess manager path involved in these callbacks and verify that CPU load for one publisher and one subscriber is comparable across the cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100