Skip to content

Optim: test that could be done once has been extracted from the loop#17638

Merged
opencv-pushbot merged 1 commit intoopencv:3.4from
pemmanuelviel:pev--avoid-branching-in-loop
Jun 26, 2020
Merged

Optim: test that could be done once has been extracted from the loop#17638
opencv-pushbot merged 1 commit intoopencv:3.4from
pemmanuelviel:pev--avoid-branching-in-loop

Conversation

@pemmanuelviel
Copy link
Copy Markdown
Contributor

@pemmanuelviel pemmanuelviel commented Jun 23, 2020

closes #17613

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under OpenCV (BSD) License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • There is reference to original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

@pemmanuelviel
Copy link
Copy Markdown
Contributor Author

Nowadays compiler should handle similarly both versions. However, checking quickly the assembly code obtained from an online tool between both versions, it looks like it might not be the case. So I've preferred to ensure a single evaluation of the condition whatever the compiler efficiency.
What do you think?

Copy link
Copy Markdown
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

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

Looks good to me! Thank you for contribution 👍

@opencv-pushbot opencv-pushbot merged commit e45d74c into opencv:3.4 Jun 26, 2020
@alalek alalek mentioned this pull request Jun 29, 2020
@pemmanuelviel pemmanuelviel deleted the pev--avoid-branching-in-loop branch July 2, 2020 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants