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

CSHARP-5125 Span support for ObjectId ctor, Parse, TryParse, BsonUtils hex conversion

Open Kloizdena opened this issue 1 year ago • 1 comments

  • Eliminated unneeded allocations from Parse and ToString()
  • Added Span overloads for ctor, Parse, TryParse, ToHexChars, ToByteSpan methods.

Local benchmark results:

Method Mean Error StdDev Gen0 Allocated
ToString_Original 33.47 ns 2.004 ns 5.877 ns 0.0172 144 B
ToString_New 35.48 ns 0.713 ns 0.792 ns 0.0086 72 B
Parse_Original 33.72 ns 0.699 ns 0.546 ns 0.0048 40 B
Parse_New 26.23 ns 0.547 ns 1.311 ns - -

Kloizdena avatar Sep 26 '24 19:09 Kloizdena

Thanks @Kloizdena for your PR. CSHARP-5125 is not a priority in the upcoming quarter. We will consider this PR when CSHARP-5125 gets scheduled as part of our serialization improvement effort.

BorisDog avatar Oct 22 '24 23:10 BorisDog