perf(control): use emplace/emplace_back to avoid temporary object creation#12236
Conversation
Signed-off-by: nishikawa-masaki <masaki.nishikawa@tier4.jp>
|
Thank you for contributing to the Autoware project! 🚧 If your pull request is in progress, switch it to draft mode. Please ensure:
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #12236 +/- ##
==========================================
+ Coverage 18.55% 19.48% +0.92%
==========================================
Files 1888 1888
Lines 129750 129865 +115
Branches 45921 48119 +2198
==========================================
+ Hits 24080 25307 +1227
- Misses 85854 86056 +202
+ Partials 19816 18502 -1314
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Jazzy CI test "build-test-tidy-pr / clang-tidy-differential (jazzy) / clang-tidy-differential (pull_request)" fails, but it is a known problem with Jazzy and can be ignored (not Required). This PR is still in Draft state because this PR and #12238 should be tested on Evaluator. |
|
The commit history of this PR needs squashing on merging. |
Description
This PR optimizes STL container usage in the
controlpackages to reduce temporary object creation, improving runtime performance and reducing memory overhead.Specifically, the following changes were made:
autoware_collision_detector: Replacedpush_backwithemplace_backwhen constructingautoware_utils_geometry::Point2dobjects in loops.autoware_pid_longitudinal_controller: Replaced call topush_backwithemplace_backforstd::pairinsertion into the velocity history vector, avoiding the creation of a temporary pair object.Related links
Parent Issue:
Private Links:
How was this PR tested?
Notes for reviewers
These changes are pure refactoring for performance optimization and do not alter the logic or behavior of the nodes.
Interface changes
None.
Effects on system behavior
None.
Reduced memory churn and potential slight performance improvement in affected loops.