Rclcpp Debian Package Optimization Level

Does anybody know if/what optimization level the rclcpp debian package(s) (specifically I’m looking at ros-foxy-rclcpp_2.4.2-1focal.20221012.230743_amd64.deb) is compiled using? I tried unpacking the .deb and using objdump/strings on librclcpp.so to look for a flag, and grepping/manually looking through the ament/cmake build files, but I couldn’t find any optimization flags anywhere.

This search was prompted by doing some profiling of a project using rclcpp, I found that ~ 75% of the CPU time was being taken up in rclcpp related functions, and if I could improve upon that with a “simple” -O3 flag applied somewhere, that would be awesome.

This is really more a question for ROS Answers, but to not just send you away with a “please ask this somewhere else”: rclcpp is compiled with -O2 -g -DNDEBUG. That’s basically CMake’s RelWithDebInfo (although CMAKE_BUILD_TYPE is set to None).

You can see that here in the console output. It’s all driven by a standard Debian build pipeline which knows how to talk to CMake (these are the files which Bloom uses to configure that pipeline).


Ah, did not know, I’ll direct future questions like this there. Thank you for both pointing that out and still helping out, appreciate the info very much!


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.