Skip to content

intern EquivalenceKeys for primitive types and class types of java.* - #540

Merged
Ladicek merged 1 commit into
smallrye:mainfrom
Ladicek:improve-equivalence-key-allocation-rate
Jul 3, 2025
Merged

Ladicek merged 1 commit into
smallrye:mainfrom
Ladicek:improve-equivalence-key-allocation-rate

Conversation

@Ladicek

@Ladicek Ladicek commented Jul 2, 2025 •

Copy link
Copy Markdown
Member

Primitive types and java.* class types are very commonly used and there is a limited number of them. Therefore, we can intern them safely (growth of the interning cache is naturally bounded) and improve allocation rate significantly.

Further, this commit removes all calls to Objects.hash(), because each call allocates an array. It is especially useless when called with just one element.

Co-authored-by: Guillaume Smet [email protected]

@Ladicek Ladicek added this to the 3.3.2 milestone Jul 2, 2025
@Ladicek Ladicek changed the title intern EquivalenceKeys for primitive types and class types of java.* intern EquivalenceKeys for primitive types and class types of java.* Jul 2, 2025
Primitive types and `java.*` class types are very commonly used and there
is a limited number of them. Therefore, we can intern them safely (growth
of the interning cache is naturally bounded) and improve allocation rate
significantly.

Further, this commit removes all calls to `Objects.hash()`, because each call
allocates an array. It is especially useless when called with just one element.

Co-authored-by: Guillaume Smet <[email protected]>
@Ladicek
Ladicek force-pushed the improve-equivalence-key-allocation-rate branch from b200cac to 5e41373 Compare July 3, 2025 14:14

@gsmet gsmet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like a very good first step.

@Ladicek
Ladicek merged commit 35114fe into smallrye:main Jul 3, 2025
@Ladicek
Ladicek deleted the improve-equivalence-key-allocation-rate branch July 3, 2025 14:31
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