Performance issue on ResolvableType cache [SPR-12122] #16738
Labels
status: backported
An issue that has been backported to maintenance branches
type: enhancement
A general enhancement
Milestone
Sébastien Deleuze opened SPR-12122 and commented
While working on Spring Flex issue FLEX-234, I have found that the ResolvableType cache can be really slow.
When there is a lot of entries in this HashMap, getting a simple value could take a lot of time, and the bottleneck seems to come from a lot of calls to ResolvableType.equals().
ResolvableType.equals() uses this.type, getSource(), this.variableResolver.getSource() and this.componentType but ResolvableType.hashCode() uses only this.type. This seems to be the root cause of these huge amount of slow equals() calls when ResolvableType.forType() try to get a value from the HashMap.
By using the same fields in ResolvableType.hashCode() than in ResolvableType.equals(), we should be able to improve performances.
I have created a benchmark project that reproduce this issue.
Affects: 4.0.6, 4.1 RC2
Reference URL: https://github.com/sdeleuze/spring-resolvabletype-benchmark
Issue Links:
Backported to: 4.0.7
The text was updated successfully, but these errors were encountered: