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

perf(behavior_path_dynamic_avoidance_module): use const reference #6981

Conversation

veqcc
Copy link
Contributor

@veqcc veqcc commented May 11, 2024

Description

This is a fix based on CppCheck warning

planning/behavior_path_dynamic_avoidance_module/src/scene.cpp:1806:46: performance: Function parameter 'outer_body_path' should be passed by const reference. [passedByValue]
      std::vector<geometry_msgs::msg::Point> outer_body_path) -> tier4_autoware_utils::Polygon2d {
                                             ^

Tests performed

No

Effects on system behavior

Interface changes

Pre-review checklist for the PR author

The PR author must check the checkboxes below when creating the PR.

In-review checklist for the PR reviewers

The PR reviewers must check the checkboxes below before approval.

Post-review checklist for the PR author

The PR author must check the checkboxes below before merging.

  • There are no open discussions or they are tracked via tickets.

After all checkboxes are checked, anyone who has write access can merge the PR.

Signed-off-by: Ryuta Kambe <ryuta.kambe@tier4.jp>
@github-actions github-actions bot added the component:planning Route planning, decision-making, and navigation. (auto-assigned) label May 11, 2024
@veqcc veqcc added tag:run-build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) and removed component:planning Route planning, decision-making, and navigation. (auto-assigned) labels May 11, 2024
@github-actions github-actions bot added the component:planning Route planning, decision-making, and navigation. (auto-assigned) label May 11, 2024
Copy link
Contributor

@yuki-takagi-66 yuki-takagi-66 left a comment

Choose a reason for hiding this comment

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

I added const to the other args

@veqcc
Copy link
Contributor Author

veqcc commented May 13, 2024

@yuki-takagi-66
Thank you for additional commit!!
Do you think those parameters should not be references?
I mean,

const strategy::distance_asymmetric<double> & path_expand_strategy,
const strategy::distance_asymmetric<double> & steer_expand_strategy,

@yuki-takagi-66
Copy link
Contributor

@veqcc
Both acceptable, but I feel those parameters should not be references, because these are small enough
https://github.com/boostorg/geometry/blob/develop/include/boost/geometry/strategies/agnostic/buffer_distance_asymmetric.hpp

@veqcc
Copy link
Contributor Author

veqcc commented May 14, 2024

@yuki-takagi-66
Thank you for your reply.
I agree to your point.

There is nothing to add from me anymore!!
Can I merge it?

@yuki-takagi-66
Copy link
Contributor

yuki-takagi-66 commented May 14, 2024

@veqcc
Yes, please
Thank you so much

@veqcc veqcc merged commit 2ae1716 into autowarefoundation:main May 14, 2024
21 of 22 checks passed
@veqcc veqcc deleted the perf/use_const_ref_in_behavior_path_dynamic_avoidance_module branch May 14, 2024 09:33
vividf pushed a commit to vividf/autoware.universe that referenced this pull request May 16, 2024
…towarefoundation#6981)

* perf(behavior_path_dynamic_avoidance_module): use const reference

Signed-off-by: Ryuta Kambe <ryuta.kambe@tier4.jp>

* style(pre-commit): autofix

* add const to the other args

---------

Signed-off-by: Ryuta Kambe <ryuta.kambe@tier4.jp>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Yuki TAKAGI <141538661+yuki-takagi-66@users.noreply.github.com>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:planning Route planning, decision-making, and navigation. (auto-assigned) tag:run-build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants