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

ament_pack_build_configuration is very slow for many dependencies #480

Open
Aposhian opened this issue Sep 8, 2023 · 4 comments
Open

ament_pack_build_configuration is very slow for many dependencies #480

Aposhian opened this issue Sep 8, 2023 · 4 comments

Comments

@Aposhian
Copy link

Aposhian commented Sep 8, 2023

When targets with many dependencies call ament_target_dependencies, this calls ament_deduplicate_libraries and then ament_pack_build_configuration. For some reason ament_pack_build_configuration takes several seconds for a moderate number of libraries.

For two libraries, it takes 250ms (which is still kind of slow), but this ends up being the minority of the work done under ament_target_dependencies:
image

However, when you have 3632 dependencies (which seems like a lot but which is mostly separate type support libraries just from linking to Nav2) it takes 1.2 seconds. which then becomes the majority of the time of ament_target_dependencies
image

It looks like the bulk of that time comes from all the calls to

list(GET _argn ${_index} _lib)

for every single element, and that access takes 0.315ms, but that addes up over a lot of dependencies.

When building packages, this adds several seconds to the build time, just to add semicolons between library names.

This is on humble with ament_cmake 1.3.5.

@Aposhian
Copy link
Author

Aposhian commented Sep 8, 2023

Another example: here is a build of nav2_behavior_tree. You can see that the majority of the time in CMake build time ends up being due to this call, repeated many times for multiple targets:
image

@sloretz
Copy link
Contributor

sloretz commented Sep 11, 2023

Does replacing ament_target_dependencies() with target_link_libraries() #292 resolve the issue?

@Aposhian
Copy link
Author

Yes

@VRichardJP
Copy link
Contributor

VRichardJP commented Dec 15, 2023

See #447 (comment) and #448

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

No branches or pull requests

3 participants