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(autoware_map_based_prediction): enhance speed by removing unnecessary calculation #8471

Conversation

yhisaki
Copy link
Contributor

@yhisaki yhisaki commented Aug 14, 2024

Description

Multiple places were found where boost::geometry::within(...) was used immediately after auto [dist, lanelet] = lanelet::geometry::findNearest(...) (especially in places using withinLanelet). However, since dist being 0 and boost::geometry::within(...) returning true are equivalent, the redundant processing was eliminated.

https://wandbox.org/permlink/u3KhRExZACGjSf5Z

This change slightly improves performance.
before

⏰ Worst Case Execution Time ⏰
objectsCallback: total 7.75 [ms], avg. 7.75 [ms], run count: 1
    ├── trafficSignalsCallback: total 0.00 [ms], avg. 0.00 [ms], run count: 1
    ├── removeStaleTrafficLightInfo: total 0.00 [ms], avg. 0.00 [ms], run count: 1
    ├── updateObjectData: total 0.00 [ms], avg. 0.00 [ms], run count: 19
    ├── getCurrentLanelets: total 1.17 [ms], avg. 0.06 [ms], run count: 19
    │   ├── checkCloseLaneletCondition: total 0.40 [ms], avg. 0.00 [ms], run count: 190
    │   ├── isDuplicated: total 0.00 [ms], avg. 0.00 [ms], run count: 18
    │   └── calculateLocalLikelihood: total 0.06 [ms], avg. 0.00 [ms], run count: 15
    ├── updateRoadUsersHistory: total 0.06 [ms], avg. 0.00 [ms], run count: 19
    ├── getPredictedReferencePath: total 0.29 [ms], avg. 0.06 [ms], run count: 5
    │   ├── predictObjectManeuver: total 0.07 [ms], avg. 0.01 [ms], run count: 6
    │   │   └── predictObjectManeuverByLatDiffDistance: total 0.06 [ms], avg. 0.01 [ms], run count: 6
    │   │       └── calcRightLateralOffset: total 0.00 [ms], avg. 0.00 [ms], run count: 8
    │   ├── calculateManeuverProbability: total 0.00 [ms], avg. 0.00 [ms], run count: 6
    │   └── addReferencePaths: total 0.10 [ms], avg. 0.01 [ms], run count: 18
    │       ├── updateFuturePossibleLanelets: total 0.00 [ms], avg. 0.00 [ms], run count: 9
    │       └── convertPathType: total 0.05 [ms], avg. 0.01 [ms], run count: 9
    ├── updateCrosswalkUserHistory: total 0.00 [ms], avg. 0.00 [ms], run count: 54
    └── getPredictedObjectAsCrosswalkUser: total 5.19 [ms], avg. 0.10 [ms], run count: 54
        ├── getTrafficSignalId: total 0.00 [ms], avg. 0.00 [ms], run count: 113
        ├── calcIntentionToCrossWithTrafficSignal: total 0.11 [ms], avg. 0.00 [ms], run count: 113
        │   └── getTrafficSignalElement: total 0.00 [ms], avg. 0.00 [ms], run count: 113
        └── doesPathCrossAnyFence: total 0.00 [ms], avg. 0.00 [ms], run count: 32

after

⏰ Worst Case Execution Time ⏰
objectsCallback: total 5.76 [ms], avg. 5.76 [ms], run count: 1
    ├── trafficSignalsCallback: total 0.01 [ms], avg. 0.01 [ms], run count: 1
    ├── removeStaleTrafficLightInfo: total 0.00 [ms], avg. 0.00 [ms], run count: 1
    ├── updateObjectData: total 0.00 [ms], avg. 0.00 [ms], run count: 21
    ├── getCurrentLanelets: total 1.24 [ms], avg. 0.06 [ms], run count: 21
    │   ├── checkCloseLaneletCondition: total 0.44 [ms], avg. 0.00 [ms], run count: 210
    │   ├── isDuplicated: total 0.00 [ms], avg. 0.00 [ms], run count: 19
    │   └── calculateLocalLikelihood: total 0.04 [ms], avg. 0.00 [ms], run count: 14
    ├── updateRoadUsersHistory: total 0.07 [ms], avg. 0.00 [ms], run count: 21
    ├── getPredictedReferencePath: total 0.37 [ms], avg. 0.05 [ms], run count: 7
    │   ├── predictObjectManeuver: total 0.05 [ms], avg. 0.01 [ms], run count: 5
    │   │   └── predictObjectManeuverByLatDiffDistance: total 0.04 [ms], avg. 0.01 [ms], run count: 5
    │   │       └── calcRightLateralOffset: total 0.00 [ms], avg. 0.00 [ms], run count: 12
    │   ├── calculateManeuverProbability: total 0.00 [ms], avg. 0.00 [ms], run count: 5
    │   └── addReferencePaths: total 0.15 [ms], avg. 0.01 [ms], run count: 15
    │       ├── updateFuturePossibleLanelets: total 0.00 [ms], avg. 0.00 [ms], run count: 10
    │       └── convertPathType: total 0.09 [ms], avg. 0.01 [ms], run count: 10
    ├── updateCrosswalkUserHistory: total 0.00 [ms], avg. 0.00 [ms], run count: 41
    └── getPredictedObjectAsCrosswalkUser: total 3.19 [ms], avg. 0.08 [ms], run count: 41
        ├── getTrafficSignalId: total 0.00 [ms], avg. 0.00 [ms], run count: 88
        ├── calcIntentionToCrossWithTrafficSignal: total 0.06 [ms], avg. 0.00 [ms], run count: 88
        │   └── getTrafficSignalElement: total 0.00 [ms], avg. 0.00 [ms], run count: 88
        └── doesPathCrossAnyFence: total 0.00 [ms], avg. 0.00 [ms], run count: 15

Related links

Parent Issue:

  • Link

How was this PR tested?

https://evaluation.tier4.jp/evaluation/reports/995d3b8a-1cf9-55a8-97f4-db6152dd8896?project_id=prd_jt

Notes for reviewers

None.

Interface changes

None.

Effects on system behavior

None.

@github-actions github-actions bot added the component:perception Advanced sensor data processing and environment understanding. (auto-assigned) label Aug 14, 2024
Copy link

github-actions bot commented Aug 14, 2024

Thank you for contributing to the Autoware project!

🚧 If your pull request is in progress, switch it to draft mode.

Please ensure:

@yhisaki yhisaki added the tag:run-build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Aug 14, 2024
@yhisaki yhisaki self-assigned this Aug 14, 2024
Copy link

codecov bot commented Aug 14, 2024

Codecov Report

Attention: Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.

Project coverage is 23.89%. Comparing base (991cb94) to head (df193b4).
Report is 3 commits behind head on main.

Files Patch % Lines
...based_prediction/src/map_based_prediction_node.cpp 0.00% 8 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8471   +/-   ##
=======================================
  Coverage   23.89%   23.89%           
=======================================
  Files        1380     1382    +2     
  Lines      101829   101810   -19     
  Branches    38779    38775    -4     
=======================================
- Hits        24333    24329    -4     
+ Misses      75033    74993   -40     
- Partials     2463     2488   +25     
Flag Coverage Δ *Carryforward flag
differential 2.18% <0.00%> (?)
total 23.92% <ø> (+0.03%) ⬆️ Carriedforward from 31e2027

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

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

Copy link
Contributor

@ktro2828 ktro2828 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@YoshiRi YoshiRi left a comment

Choose a reason for hiding this comment

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

LGTM

…nnecessary-process-in-map_based_prediction

Signed-off-by: Y.Hisaki <[email protected]>
@yhisaki yhisaki enabled auto-merge (squash) August 15, 2024 01:51
Signed-off-by: Y.Hisaki <[email protected]>
@yhisaki yhisaki merged commit 1f32972 into autowarefoundation:main Aug 15, 2024
28 of 30 checks passed
technolojin pushed a commit to technolojin/autoware.universe that referenced this pull request Aug 15, 2024
…ssary calculation (autowarefoundation#8471)

* fix(autoware_map_based_prediction): use surrounding_crosswalks instead of external_surrounding_crosswalks

Signed-off-by: Y.Hisaki <[email protected]>

* perf(autoware_map_based_prediction): enhance speed by removing unnecessary calculation

Signed-off-by: Y.Hisaki <[email protected]>

---------

Signed-off-by: Y.Hisaki <[email protected]>
technolojin added a commit to tier4/autoware.universe that referenced this pull request Aug 15, 2024
…ssary calculation (#1469)

perf(autoware_map_based_prediction): enhance speed by removing unnecessary calculation (autowarefoundation#8471)

* fix(autoware_map_based_prediction): use surrounding_crosswalks instead of external_surrounding_crosswalks



* perf(autoware_map_based_prediction): enhance speed by removing unnecessary calculation



---------

Signed-off-by: Y.Hisaki <[email protected]>
Co-authored-by: Yukinari Hisaki <[email protected]>
@yhisaki yhisaki deleted the remove-unnecessary-process-in-map_based_prediction branch August 15, 2024 07:54
xtk8532704 pushed a commit to tier4/autoware.universe that referenced this pull request Aug 15, 2024
…ssary calculation (autowarefoundation#8471)

* fix(autoware_map_based_prediction): use surrounding_crosswalks instead of external_surrounding_crosswalks

Signed-off-by: Y.Hisaki <[email protected]>

* perf(autoware_map_based_prediction): enhance speed by removing unnecessary calculation

Signed-off-by: Y.Hisaki <[email protected]>

---------

Signed-off-by: Y.Hisaki <[email protected]>
Signed-off-by: xtk8532704 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:perception Advanced sensor data processing and environment understanding. (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.

4 participants