Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the compilation time of rviz_default_plugins #1007

Merged
merged 13 commits into from
Jul 10, 2023

Conversation

clalancette
Copy link
Contributor

The main goal of this PR is to improve the compilation time of rviz_default_plugins. To do that, there are a number of patches in here which do quite a bit of cleanup. The most important to mention are:

  1. Cleaning up the rviz_visual_testing_framework package to be a more complete package, exporting all dependencies correctly.
  2. Switching rviz_default_plugins to use target_link_libraries instead of ament_target_dependencies.
  3. Switch the rviz_default_plugins tests to use libraries where possible (while avoiding the ODR problems of the past).

The net result of all of this is that in my local testing, compilation time is now 12% better. That doesn't seem like a huge percentage gain, but it is 40 seconds faster locally. If that percentage maintains on the buildfarm, then this will be several minutes faster on Windows.

The main motivation here is to remove an exported absolute
path from this package.  To do this, mark everything in
the CMakeLists.txt private that we can.

This ended up exposing a bunch of missing dependencies
in rviz_default_plugins, so fix those here as well.

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
These are the last RViz packages that need this update.

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
These are already found in the main code, so we don't
need to re-find them for tests.

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
This makes it easier for us to see which tests have
which dependencies, and is more correct.

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
They are not compilable files, so it is nonsensical to
pass them to ament_add_g{test,mock}

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
That is, stop using ament_target_dependencies and instead
switch to target_link_libraries everywhere.  This is the
more modern CMake way to do things, and gives us finer
grain control over whether dependencies should be PUBLIC
or PRIVATE.

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
By making a library we skip compiling the same file
multiple times for different tests.

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
By making a library we skip compiling the same file
multiple times for different tests.

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
By making a library we skip compiling the same file
multiple times for different tests.

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
By making a library we skip compilingthe same file
multiple times for different tests.

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
By making a library we skip compiling the same file
multiple times for different tests.

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
By making a library we skip compiling the same file
multiple times for different tests.  This particular
piece of code should be safe from gtest/gmock ODR
errors since it does not use that functionality at all.

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
@clalancette clalancette requested a review from ahcorde as a code owner July 7, 2023 13:56
@ahcorde
Copy link
Contributor

ahcorde commented Jul 7, 2023

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

@clalancette
Copy link
Contributor Author

Bah humbug. The switch to C++17 is triggering some Windows warnings.

Since that is a nice to have and not an integral part of this PR, I'm going to just revert that bit and try again.

@clalancette
Copy link
Contributor Author

New CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status
  • Windows Debug Build Status

@clalancette
Copy link
Contributor Author

Not a full apples-to-apples comparison, but this does seem to be about 5 minutes faster on Windows debug than on the nightlies. So a modest improvement, but an improvement nonetheless.

@ahcorde This is probably going to conflict with your other PRs. How do you want to handle this? Put this in first and then rebase yours? Or get your other ones in and then rebase this one?

@ahcorde ahcorde merged commit 5af8896 into rolling Jul 10, 2023
2 checks passed
@delete-merged-branch delete-merged-branch bot deleted the clalancette/cmake-cleanup branch July 10, 2023 10:45
@ahcorde
Copy link
Contributor

ahcorde commented Jul 10, 2023

I will merge this first I will update my PRs, thank you for this improvement!

@ahcorde
Copy link
Contributor

ahcorde commented Jul 10, 2023

@clalancette are you planning to backport this ?

@ahcorde
Copy link
Contributor

ahcorde commented Jul 13, 2023

https://github.com/Mergifyio backport iron

@mergify
Copy link

mergify bot commented Jul 13, 2023

backport iron

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Jul 13, 2023
* Cleanup rviz_visual_testing_framework CMakeLists.txt

The main motivation here is to remove an exported absolute
path from this package.  To do this, mark everything in
the CMakeLists.txt private that we can.

This ended up exposing a bunch of missing dependencies
in rviz_default_plugins, so fix those here as well.

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
(cherry picked from commit 5af8896)
ahcorde pushed a commit that referenced this pull request Jul 18, 2023
* Cleanup rviz_visual_testing_framework CMakeLists.txt

The main motivation here is to remove an exported absolute
path from this package.  To do this, mark everything in
the CMakeLists.txt private that we can.

This ended up exposing a bunch of missing dependencies
in rviz_default_plugins, so fix those here as well.

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
(cherry picked from commit 5af8896)

Co-authored-by: Chris Lalancette <clalancette@gmail.com>
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.

None yet

2 participants