mongo-csharp-driver
mongo-csharp-driver copied to clipboard
CSHARP-5348: Avoid allocations for Bson*Context
See CSHARP-5348 for details.
This PR is split into three commits
- First, adds PopContext if it is missing from Bson*Context (no logic change)
- Second, adds a PushContext method (no logic change)
- The third adds the caching logic to Bson*Context.
If the first and second commits should be separated, I can reduce the PR to just the caching logic. For our environment, the BsonBinaryReader
/BsonBinaryWriter
are also the most important ones.