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

Don't use hashmap for zpage buckets since the keys are constant. #3649

Merged
merged 1 commit into from
Sep 22, 2021

Conversation

anuraaga
Copy link
Contributor

@anuraaga anuraaga commented Sep 22, 2021

Nullness checker found the usage of Map.get() without null check, which in practice wasn't an issue since we prepopulate the map with all values of an enum. So in other words the keys to the maps were constant (well one of them only had one item inside). This made me think we should just use constants instead.

We can expect a significant performance improvement since complete enumswitch is just a single jump (though switching from HashMap to EnumMap would have gotten very similar improvement, but still require adding nullness casts)

Copy link
Contributor

@jkwatson jkwatson left a comment

Choose a reason for hiding this comment

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

seems fine!

@jkwatson jkwatson merged commit b1e1c47 into open-telemetry:main Sep 22, 2021
This was referenced Dec 19, 2021
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.

2 participants