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(motion_utils): faster removeOverlapPoints and calcLateralOffset functions #5385

Merged

Conversation

maxime-clem
Copy link
Contributor

@maxime-clem maxime-clem commented Oct 23, 2023

Description

Make the removeOverlapPoints and calcLateralOffset functions faster, simply by calling reserve on the vector created in removeOverlapPoints.

Tests performed

Benchmark test (disabled by default) was added. It calls the function 10000 times on a trajectory with 1000 points.

  • Without the fix: ~250ms.
  • After the fix: ~80ms.

To test on you local machine:

./build/motion_utils/test_motion_utils --gtest_filter=trajectory_benchmark.\* --gtest_also_run_disabled_tests

Effects on system behavior

None.

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.

Benchmark should be run with command ./build/motion_utils/test_motion_utils --gtest_filter=trajectory_benchmark.\* --gtest_also_run_disabled_tests

Signed-off-by: Maxime CLEMENT <maxime.clement@tier4.jp>
Signed-off-by: Maxime CLEMENT <maxime.clement@tier4.jp>
Signed-off-by: Maxime CLEMENT <maxime.clement@tier4.jp>
Signed-off-by: Maxime CLEMENT <maxime.clement@tier4.jp>
@github-actions github-actions bot added the component:common Common packages from the autoware-common repository. (auto-assigned) label Oct 23, 2023
Signed-off-by: Maxime CLEMENT <maxime.clement@tier4.jp>
Signed-off-by: Maxime CLEMENT <maxime.clement@tier4.jp>
@maxime-clem maxime-clem added the tag:run-build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Oct 24, 2023
Signed-off-by: Maxime CLEMENT <maxime.clement@tier4.jp>
@codecov
Copy link

codecov bot commented Oct 24, 2023

Codecov Report

Attention: 20 lines in your changes are missing coverage. Please review.

Comparison is base (69813cb) 14.76% compared to head (5887861) 14.76%.
Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5385      +/-   ##
==========================================
- Coverage   14.76%   14.76%   -0.01%     
==========================================
  Files        1662     1663       +1     
  Lines      115457   116135     +678     
  Branches    35639    36018     +379     
==========================================
+ Hits        17047    17142      +95     
- Misses      79181    79695     +514     
- Partials    19229    19298      +69     
Flag Coverage Δ *Carryforward flag
differential 18.13% <0.00%> (?)
total 14.76% <ø> (ø) Carriedforward from 69813cb

*This pull request uses carry forward flags. Click here to find out more.

Files Coverage Δ
...ils/include/motion_utils/trajectory/trajectory.hpp 65.54% <0.00%> (-0.12%) ⬇️
...est/src/trajectory/benchmark_calcLateralOffset.cpp 0.00% <0.00%> (ø)

... and 9 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@maxime-clem maxime-clem merged commit 9000f43 into autowarefoundation:main Nov 10, 2023
23 of 26 checks passed
@maxime-clem maxime-clem deleted the benchmark/calcLateralOffset branch November 10, 2023 08:36
takayuki5168 pushed a commit to tier4/autoware.universe that referenced this pull request Nov 22, 2023
…functions (autowarefoundation#5385)

Signed-off-by: Maxime CLEMENT <maxime.clement@tier4.jp>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:common Common packages from the autoware-common repository. (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.

2 participants