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

fix(distortion_correction_node): remove redundant code #6758

Closed
wants to merge 3 commits into from

Conversation

vividf
Copy link
Contributor

@vividf vividf commented Apr 8, 2024

Description

There is a for-loop and a while loop doing the same thing. Basically, when implementing the while loop, the contributor forgot to delete it.
https://github.com/autowarefoundation/autoware.universe/pull/2913/files

Tests performed

Not applicable.

Effects on system behavior

Not applicable.

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.

@vividf vividf requested a review from kminoda April 8, 2024 03:46
@vividf vividf self-assigned this Apr 8, 2024
@github-actions github-actions bot added the component:sensing Data acquisition from sensors, drivers, preprocessing. (auto-assigned) label Apr 8, 2024
@yukkysaito
Copy link
Contributor

yukkysaito commented Apr 8, 2024

@vividf Since the code appears to be designed to improve performance, it is better to check the execution time impact.
related link : #2913

@kminoda kminoda added the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Apr 11, 2024
@kminoda
Copy link
Contributor

kminoda commented Apr 11, 2024

Thank you for the PR 🙏

@yukkysaito My understanding is that this modification does not change any performance, simply increasing the readability of the code by removing "purely" redundant code, given that the following while loop does exactly the same thing as the for loop.

@vividf Would you confirm if the above argument is correct?

@vividf
Copy link
Contributor Author

vividf commented Apr 11, 2024

@kminoda
Yes, you are correct :)

@yukkysaito
In the PR, [#2913], you can also see that the author removed the for loop and added the while loop for optimization for twist. But for imu, only the while loop was added.
I also analyze the time difference (green: remove for-loop, red: original)
image

Below is the value of the above graph (100 samples)
Remove for-loop:
min: 5.1, max: 11.98, avg: 6.56

Original
min: 5.29, max: 11.95, avg: 6.88

The value average processing time is lower because the current implementation still uses the for-loop. By removing the for-loop and using the while loop that the author implemented it will decrease the time.

reference:
#(https://github.com/autowarefoundation/autoware.universe/pull/2913/files#:~:text=it_y%2C%20%2B%2Bit_z%2C%20%2B%2Bit_time_stamp)%20%7B-,for%20(%3B,%2B%2Btwist_it)%20%7B,-while%20(twist_it)

Copy link
Contributor

@kminoda kminoda left a comment

Choose a reason for hiding this comment

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

LGTM

@vividf vividf enabled auto-merge (squash) April 11, 2024 07:50
@vividf vividf disabled auto-merge April 11, 2024 07:50
@badai-nguyen
Copy link
Contributor

@vividf could you resolve conflict?

@vividf
Copy link
Contributor Author

vividf commented Apr 19, 2024

Due to the approval being late, another PR (#6843) also solved this.

@vividf vividf closed this Apr 19, 2024
@vividf vividf deleted the fix_redundant_code branch May 1, 2024 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:sensing Data acquisition from sensors, drivers, preprocessing. (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.

4 participants