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

feat(tier4_autoware_utils): faster sin and cos #7120

Merged
merged 4 commits into from
May 27, 2024

Conversation

veqcc
Copy link
Contributor

@veqcc veqcc commented May 24, 2024

Description

I have implemented a faster sin ans cos calculation.
Calling sin_and_cos is faster than calling sin and cos separately.

It is useful, for example, for DistortionCorrector.
I found that around 35% of CPU time in DistortionCorrector is occupied by sin and cos,
and I have confirmed 10~20% latency improvement with faster sin_and_cos. cc @vividf

Tests performed

I have written a test code and the test has passed.

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: veqcc <ryuta.kambe@tier4.jp>
@github-actions github-actions bot added the component:common Common packages from the autoware-common repository. (auto-assigned) label May 24, 2024
veqcc and others added 2 commits May 27, 2024 09:39
Signed-off-by: veqcc <ryuta.kambe@tier4.jp>
@veqcc veqcc added the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label May 27, 2024
@veqcc
Copy link
Contributor Author

veqcc commented May 27, 2024

@soblin
It invoked the following clang-tidy warning

/__w/autoware.universe/autoware.universe/common/tier4_autoware_utils/src/math/trigonometry.cpp:63:5: warning: do not use 'else' after 'return' [readability-else-after-return]
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
  } else if (discrete_arcs_num_90 <= idx && idx < 2 * discrete_arcs_num_90) {
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Do you think we should avoid it?
In my opinion, we can ignore it.

@soblin
Copy link
Contributor

soblin commented May 27, 2024

Yes, we can just ignore it.

@veqcc veqcc merged commit 65c2c51 into autowarefoundation:main May 27, 2024
33 of 35 checks passed
@veqcc veqcc deleted the feat/faster_sin_and_cos branch May 27, 2024 04:59
karishma1911 pushed a commit to Interplai/autoware.universe that referenced this pull request Jun 3, 2024
* feat(tier4_autoware_utils): faster sin and cos

Signed-off-by: veqcc <ryuta.kambe@tier4.jp>
a-maumau pushed a commit to a-maumau/autoware.universe that referenced this pull request Jun 7, 2024
* feat(tier4_autoware_utils): faster sin and cos

Signed-off-by: veqcc <ryuta.kambe@tier4.jp>
KhalilSelyan pushed a commit that referenced this pull request Jul 22, 2024
* feat(tier4_autoware_utils): faster sin and cos

Signed-off-by: veqcc <ryuta.kambe@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) 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