mongo-csharp-driver icon indicating copy to clipboard operation
mongo-csharp-driver copied to clipboard

CSHARP-5348: Avoid allocations for Bson*Context

Open obligaron opened this issue 4 months ago • 0 comments

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.

obligaron avatar Oct 21 '24 20:10 obligaron