Skip to content

Improve SimpleKey hashing function #34483

Closed
@bclozel

Description

@bclozel

SimpleKey is used in Spring Framework's caching support and its hashCode value can be used to efficiently store this key in data structures. As discussed with @ben-manes, the current hashcode strategy works, but the resulting values don't spread well enough when input keys are sequential (which is often the case). This can have negative performance impacts, depending on the data structures used by the cache implementation.

We should improve the hashCode function with a mixer function to better spread the hash values. While this is not a bug in Spring Framework this should improve performance for some cache implementations in production.

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions