Skip to content

Check Tags instanceof check before iterator empty check in Tags.of() #6148

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

Open
wants to merge 1 commit into
base: 1.13.x
Choose a base branch
from

Conversation

izeye
Copy link
Contributor

@izeye izeye commented Apr 20, 2025

This PR changes to check Tags instanceof check before iterator empty check in Tags.of() to save ArrayIterator creation.

@shakuzen shakuzen added enhancement A general enhancement performance Issues related to general performance module: micrometer-core An issue that is related to our core module labels Apr 21, 2025
Copy link
Member

@shakuzen shakuzen left a comment

Choose a reason for hiding this comment

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

Thanks. I had in my notes to make this change, but I was curious to benchmark if there's a noticeable difference with this. I haven't had a chance yet to look into it more deeply, but on the surface it certainly seems worth avoiding the allocation if we can.

@jonatan-ivanov jonatan-ivanov added this to the 1.13.14 milestone Apr 21, 2025
@shakuzen shakuzen modified the milestones: 1.13.14, 1.13.x May 12, 2025
@shakuzen
Copy link
Member

I still haven't had a chance to do the deeper dive I wanted on this and similar changes. I don't expect it would cause any problem, but I'll hold off on merging it until next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A general enhancement module: micrometer-core An issue that is related to our core module performance Issues related to general performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants