ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org
Ask Your Question
0

Slower performance of ROS2 Galactic with local build vs pre-built binaries

asked 2022-04-21 16:01:03 -0600

AspireChef gravatar image

I've got pre-built binaries for ROS2 Galactic installed on my Ubuntu 20.04 machine. No issues with getting that going -- the demo_nodes_cpp & demo_nodes_py test examples work as expected.

Checking into performance as part of some other investigations I'm doing, I compiled this package from Github: https://github.com/berndpfrommer/ros2...

Running that with RMW_IMPLEMENTATION=rmw_cyclonedds_cpp ros2 run ros2_issues publisher_node --ros-args -p num_elements:=50000 -p rate:=1000, I see the following performance numbers:

[INFO] [1650574539.746257732] [test_publisher]: pub rate:    31.25
[INFO] [1650574540.757245605] [test_publisher]: pub rate:    31.65
[INFO] [1650574541.775833948] [test_publisher]: pub rate:    31.42

Further, I'm able to build ROS2 Galactic Geochelone from source following the instructions here: https://docs.ros.org/en/galactic/Inst...

No issues with that either. Running the demo_nodes_cpp and demo_nodes_py test examples work as expected.

If I source my local build of ROS2, however, and run the "ros2_issues" package as above, however, I get the following performance numbers which are worse than with the pre-built binaries:

[INFO] [1650572322.229327451] [test_publisher]: pub rate:    10.90
[INFO] [1650572323.231439150] [test_publisher]: pub rate:    10.98
[INFO] [1650572324.236953146] [test_publisher]: pub rate:    10.94

Am I missing optimization issues with my local ROS2 build? Is something else at play?

Thanks!

TLDR: Building ROS2 Galactic locally vs using pre-built binaries is giving me markedly different results with a package that demonstrates ros2 performance issues. Any ideas what may be causing the difference? Is my local build missing optimization settings for compilation maybe?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2022-04-22 04:09:11 -0600

gvdhoorn gravatar image

Did you use the exact command given in the "from source" installation documentation you link?

If so: that doesn't appear to enable optimisations.

You could set the CMake build type using:

colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo

or straight Release, but perhaps still having debug info available is good while developing.

I'd probably clean out your workspace before rerunning colcon build, just to make sure.

This isn't the only way in which you can set CMake arguments, but it's an easy way to test whether this makes a difference.

Note that building from source isn't / shouldn't really be the default/first thing to do, so if you can use the provided binary packages, I'd do that.

edit flag offensive delete link more

Comments

@gvdhoorn You were 100% correct in your comment. I rebuilt with --cmake-args -DCMAKE_BUILD_TYPE=Release and now the performance matches the pre-built binaries. Thanks so much for the answer! I didn't realize the default build does not optimize for execution.

AspireChef gravatar image AspireChef  ( 2022-04-22 07:56:39 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2022-04-21 16:01:03 -0600

Seen: 88 times

Last updated: Apr 22 '22