Skip to content

Proposal for C++ based ros2 topic hz #1043

@sgillen

Description

@sgillen

Hello, I am considering putting together an MR to contribute a more performant C++ implementation of ros2 topic hz (and maybe ros2 topic bw while we are at it).

I think even with #1005 merged, performance of ros2 topic hz remains poor, especially for high frequency topics. I think #843 is still an issue. I did some informal experiments awhile ago to confirm this, which I can replicate and share if desired (did anyone else run experiments on this btw? would be good to compare notes)

When I switch to a C++ based implementation I see a ~8x reduction in CPU usage, and can accurately report topic frequencies up to 10Khz, whereas the existing ros2 topic hz caps out around a 2-3khz.

There are two caveats to this that I see already.

  1. Using C++ from the python topic verb will require pybind11 or ctypes, which may complicate distribution.
  2. the --filter option accepts arbitrary python code, so likely we would want to fallback to the original hz.py implementation just for --filter, which is a little ugly.

I'd like to get the maintainers thoughts on this, would this MR be something you are interested in merging? Are there other gotchas I am not considering?

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions