-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Replication
Creating a TagSet is expensive – every time we do it, we allocate an underlying BSONArray which in turn dynamically allocates a buffer.
We are much too cavalier with creating TagSets. For example, we will create an empty TagSet for comparison here then immediately throw away the buffer we created. We will also create an empty TagSet to feed into creating a ReadPreferenceSetting and will potentially overwrite this with another TagSet buffer.
I have a patch that avoids these allocations – this can be a good place to start. But we have potential here to cut down on what amounts to thousands of allocations in a ten minute workload.