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

[20283] Return const reference in get_log_resources #4271

Merged
merged 2 commits into from
Jan 27, 2024

Conversation

EduPonz
Copy link

@EduPonz EduPonz commented Jan 22, 2024

Description

Every log call gets the verbosity of the log by calling get_log_resources()->GetVerbosity(). Prior to this PR, the call to get_log_resources() would copy the internal shared pointer, which can become a costly operation, specially in a multithreaded context. This PR changes that internal method to return a const reference to the shared pointer instead of a copy.

@Mergifyio backport 2.12.x 2.11.x 2.10.x 2.6.x

Contributor Checklist

  • Commit messages follow the project guidelines.
  • The code follows the style guidelines of this project.
  • N/A: Tests that thoroughly check the new feature have been added/Regression tests checking the bug and its fix have been added; the added tests pass locally
  • N/A: Any new/modified methods have been properly documented using Doxygen.
  • Changes are ABI compatible.
  • Changes are API compatible.
  • N/A: New feature has been added to the versions.md file (if applicable).
  • N/A: New feature has been documented/Current behavior is correctly described in the documentation.
  • Applicable backports have been included in the description.

Reviewer Checklist

  • The PR has a milestone assigned.
  • The title and description correctly express the PR's purpose.
  • Check contributor checklist is correct.
  • Check CI results: changes do not issue any warning.
  • Check CI results: failing tests are unrelated with the changes.

Signed-off-by: EduPonz <eduardoponz@eprosima.com>
@EduPonz EduPonz added this to the v2.13.2 milestone Jan 22, 2024
@EduPonz
Copy link
Author

EduPonz commented Jan 22, 2024

@Mergifyio backport 2.12.x 2.11.x 2.10.x 2.6.x

Copy link
Contributor

mergify bot commented Jan 22, 2024

backport 2.12.x 2.11.x 2.10.x 2.6.x

✅ Backports have been created

JesusPoderoso
JesusPoderoso previously approved these changes Jan 22, 2024
Copy link
Contributor

@JesusPoderoso JesusPoderoso left a comment

Choose a reason for hiding this comment

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

LGTM with green CI

@JesusPoderoso JesusPoderoso added the ci-pending PR which CI is running label Jan 22, 2024
@JesusPoderoso
Copy link
Contributor

@richiprosima please test windows please test mac

Signed-off-by: EduPonz <eduardoponz@eprosima.com>
@EduPonz
Copy link
Author

EduPonz commented Jan 23, 2024

@richiprosima please test this

@EduPonz
Copy link
Author

EduPonz commented Jan 24, 2024

@richiprosima please test mac

@JesusPoderoso JesusPoderoso added ready-to-merge Ready to be merged. CI and changes have been reviewed and approved. and removed ci-pending PR which CI is running labels Jan 24, 2024
@EduPonz EduPonz merged commit 06c8695 into master Jan 27, 2024
10 of 14 checks passed
@EduPonz EduPonz deleted the hotfix/log_performance branch January 27, 2024 07:59
mergify bot pushed a commit that referenced this pull request Jan 27, 2024
* Refs #20283: get_log_resources returns a const ref

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

* Refs #20283: Apply change to internal header

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

---------

Signed-off-by: EduPonz <eduardoponz@eprosima.com>
(cherry picked from commit 06c8695)
mergify bot pushed a commit that referenced this pull request Jan 27, 2024
* Refs #20283: get_log_resources returns a const ref

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

* Refs #20283: Apply change to internal header

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

---------

Signed-off-by: EduPonz <eduardoponz@eprosima.com>
(cherry picked from commit 06c8695)
mergify bot pushed a commit that referenced this pull request Jan 27, 2024
* Refs #20283: get_log_resources returns a const ref

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

* Refs #20283: Apply change to internal header

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

---------

Signed-off-by: EduPonz <eduardoponz@eprosima.com>
(cherry picked from commit 06c8695)
mergify bot pushed a commit that referenced this pull request Jan 27, 2024
* Refs #20283: get_log_resources returns a const ref

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

* Refs #20283: Apply change to internal header

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

---------

Signed-off-by: EduPonz <eduardoponz@eprosima.com>
(cherry picked from commit 06c8695)

# Conflicts:
#	include/fastrtps/rtps/network/NetworkFactory.h
#	src/cpp/fastdds/log/Log.cpp
EduPonz added a commit that referenced this pull request Feb 1, 2024
* Refs #20283: get_log_resources returns a const ref

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

* Refs #20283: Apply change to internal header

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

---------

Signed-off-by: EduPonz <eduardoponz@eprosima.com>
(cherry picked from commit 06c8695)

Co-authored-by: Eduardo Ponz Segrelles <eduardoponz@eprosima.com>
EduPonz added a commit that referenced this pull request Feb 15, 2024
* Refs #20283: get_log_resources returns a const ref

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

* Refs #20283: Apply change to internal header

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

---------

Signed-off-by: EduPonz <eduardoponz@eprosima.com>
(cherry picked from commit 06c8695)

Co-authored-by: Eduardo Ponz Segrelles <eduardoponz@eprosima.com>
EduPonz added a commit that referenced this pull request Feb 24, 2024
* Refs #20283: get_log_resources returns a const ref

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

* Refs #20283: Apply change to internal header

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

---------

Signed-off-by: EduPonz <eduardoponz@eprosima.com>
(cherry picked from commit 06c8695)

Co-authored-by: Eduardo Ponz Segrelles <eduardoponz@eprosima.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge Ready to be merged. CI and changes have been reviewed and approved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants