Skip to content

Optimize includes - #2229

Merged
v4hn merged 1 commit into
moveit:masterfrom
mvieth:master
Jul 31, 2020
Merged

v4hn merged 1 commit into
moveit:masterfrom
mvieth:master

Conversation

@mvieth

@mvieth mvieth commented Jul 30, 2020

Copy link
Copy Markdown
Contributor

Description

Remove most obvious unused includes, as recommended by include-what-you-use (see #2170)

Checklist

  • Required by CI: Code is auto formatted using clang-format
  • Extend the tutorials / documentation reference
  • Document API changes relevant to the user in the MIGRATION.md notes
  • Create tests, which fail without this PR reference
  • Include a screenshot if changing a GUI
  • While waiting for someone to review your request, please help review another open pull request to support the maintainers

Remove most obvious unused includes, as recommended by include-what-you-use (see moveit#2170)
@mvieth mvieth changed the title Optimize includes WIP: Optimize includes Jul 30, 2020
@codecov

codecov Bot commented Jul 30, 2020 •

Copy link
Copy Markdown

Codecov Report

Merging #2229 into master will increase coverage by 0.06%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2229      +/-   ##
==========================================
+ Coverage   57.63%   57.69%   +0.06%     
==========================================
  Files         326      326              
  Lines       25618    25617       -1     
==========================================
+ Hits        14765    14780      +15     
+ Misses      10853    10837      -16     
Impacted Files Coverage Δ
...tection/include/moveit/collision_detection/world.h 88.88% <ø> (ø)
...on/include/moveit/collision_detection/world_diff.h 0.00% <ø> (ø)
...on_distance_field/collision_distance_field_types.h 53.73% <ø> (ø)
...lision_distance_field/src/collision_env_hybrid.cpp 15.25% <ø> (ø)
...raint_samplers/src/default_constraint_samplers.cpp 82.54% <ø> (ø)
...eld/include/moveit/distance_field/distance_field.h 100.00% <ø> (ø)
...moveit/distance_field/propagation_distance_field.h 85.71% <ø> (ø)
...e/include/moveit/kinematics_base/kinematics_base.h 71.42% <ø> (ø)
moveit_core/profiler/src/profiler.cpp 64.10% <ø> (ø)
...veit_core/robot_model/src/revolute_joint_model.cpp 89.76% <ø> (ø)
... and 33 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5136e39...2276c46. Read the comment docs.

@mvieth mvieth changed the title WIP: Optimize includes Optimize includes Jul 31, 2020
@mvieth
mvieth marked this pull request as ready for review July 31, 2020 06:51

@v4hn v4hn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Great to see cleanup-ideas being picked up!

Did you look through the logs I posted or generate them from scratch?
Should we expect more such patches in the future or is this everything "obvious" from the include-what-you-use approach?

@v4hn
v4hn merged commit ce67918 into moveit:master Jul 31, 2020
@mvieth

mvieth commented Aug 1, 2020

Copy link
Copy Markdown
Contributor Author

Thanks! Great to see cleanup-ideas being picked up!

You are very welcome!

Did you look through the logs I posted or generate them from scratch?

I used your logs. Regarding that: how did you generate them? Did you set the option in CMakeLists.txt? Did you use the --check_also switch? Because include-what-you-use does not always check all header files.

Should we expect more such patches in the future or is this everything "obvious" from the include-what-you-use approach?

Well, yes, it is the most obvious stuff. But there is more that could be done:

  • So far, I did not replace includes with forward-declares. You would have to decide whether you find them desirable or not
  • As I mentioned above, some header files might not have been checked. If any unused includes could be removed from them, that could have a major impact
  • Some Boost includes could be replaced with more specific ones (as long as they are meant to be included by the user as per Boost docs). For Eigen, no deep includes should be used as you noted in a comment in the issue. The only possibility would be to replace <Eigen/Eigen> and <Eigen/Dense> with more specific includes, which I partly already did. For ROS, <ros/ros.h> could be replaced with more specific includes like <ros/node_handle.h>. I think that would be ok, what do you think?
  • I also so far did not add any includes to remove transitive includes, because there would be many new includes. I am not sure how big of a problem these transitive includes are, anyway
  • And some more misc stuff

rhaschke pushed a commit that referenced this pull request Aug 13, 2020
Remove most obvious unused includes, as recommended by include-what-you-use (see #2170)
@rhaschke rhaschke mentioned this pull request Aug 13, 2020
rhaschke pushed a commit that referenced this pull request Aug 13, 2020
Remove most obvious unused includes, as recommended by include-what-you-use (see #2170)
sjahr pushed a commit to sjahr/moveit that referenced this pull request Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants