Closed
Description
Craig opened SPR-12102 and commented
In #16486, CachedIntrospectionResults was changed to use a ConcurrentHashMap for typeDescriptorCache. This change is definitely positive and had a significant improvement to performance in my testing.
I think that using putIfAbsent (instead of just put) would be a further improvement in the addTypeDescriptor method. Changing:
void addTypeDescriptor(PropertyDescriptor pd, TypeDescriptor td) {
this.typeDescriptorCache.put(pd, td);
}
to
void addTypeDescriptor(PropertyDescriptor pd, TypeDescriptor td) {
this.typeDescriptorCache.putIfAbsent(pd, td);
}
should result in less writes to volatile variables improve performance of getTypeDescriptor.
Changing the other ConcurrentHashMap (strongClassCache and softClassCache) put()'s to putIfAbsent()'s would probably also be beneficial.
Affects: 4.1 RC2
Issue Links:
- Revisit class cache in CachedIntrospectionResults [SPR-11867] #16486 Revisit class cache in CachedIntrospectionResults