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

Make patterns in Names static #26

Merged
merged 1 commit into from
Aug 5, 2019

Conversation

maggieneterval
Copy link
Contributor

While helping a user profile a Clouddriver pod handling large numbers of GCE resources, we discovered that a non-trivial proportion of allocations in some threads stem from calls to Pattern.compile in Names.extractLabeledVariable, which will happen eight times every time a new Names instance is created (so, every time we call Keys.parse from Clouddriver's GCE provider). This change adds these patterns as static members of Names. It also removes the tests that call extractLabeledVariable with invalid values; since it's a private method and only called from the constructor with static values it seemed like this would be fine, but let me know if I'm missing something!

Copy link
Contributor

@cfieber cfieber left a comment

Choose a reason for hiding this comment

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

totally makes sense to me, would like to see a method to handle all the pattern building instead of duplicating those strings but otherwise LGTM

Copy link
Contributor

@brharrington brharrington left a comment

Choose a reason for hiding this comment

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

As an FYI, this has come up previously, see #21 and Netflix/spectator#551 for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants