-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: BSON
-
None
-
Dotnet Drivers
-
None
-
None
-
None
-
None
-
None
-
None
ObjectId's ToString method is among the highest of all highly frequently used methods in this library. The temporary byte array allocation that takes place inside ToString is an unnecessary one that adds workload on the GC.
Given that the same functionality can be achieved by a leaner implementation for .NET6+ and .NETStandard2.1, we propose a Span-based implementation for these two platforms so that the resulting string can by created without leaving any garbage. The old implementation can continue to be used on .NET Framework 4.7.2.