Improve SimpleKey hashing function #34483
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: enhancement
A general enhancement
Milestone
SimpleKey
is used in Spring Framework's caching support and itshashCode
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.The text was updated successfully, but these errors were encountered: