-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 2.7.2
-
Component/s: Performance, Serialization
-
None
Performance profiling in our multithreaded environment seems to indicate that BsonSerializer.LookupActualType is on the hot path during deserialization. This is caused by the current reader-writer lock implementation. There is, however, an opportunity to reduce lock contention using a non-generic Hashtable which is safe for concurrent reads as per https://docs.microsoft.com/en-us/dotnet/api/system.collections.hashtable?redirectedfrom=MSDN&view=netframework-4.7.2#thread-safety.