-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 2.7.2
-
Component/s: Performance
-
None
Synchronization in the ClassMap class is the number one performance issue in our performance tests - specifically, in BSON.applyDecodingHooks(Object)
The problem is that this lock is acquired repeatedly by any thread that is decoding elements, leading to a comb pattern of acquisitions and almost certainly not only guaranteeing contention but a moiré pattern of it leading to heavy switching overhead.
A better strategy would be a CopyOnWriteMap. We have an Apache licensed CopyOnWriteMap impl if required.