[CSHARP-2758] Add Span<T> support to ObjectId Created: 26/Sep/19  Updated: 31/Mar/22

Status: Backlog
Project: C# Driver
Component/s: API, BSON
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Minor - P4
Reporter: KUO HSUAN Assignee: Unassigned
Resolution: Unresolved Votes: 2
Labels: Span
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

.net standard 2.0


Issue Links:
Backports
backported by CSHARP-2592 Add .NET Standard 2.0 support Closed
Backwards Compatibility: Fully Compatible

 Description   

Allow ObjectId to be 

  1. Initialized by Span<byte>
  2. return Span<byte> (ToSpan())
  3. Allow Unpack to work on Span<byte>

to allow performance boost in certain scenarios.

This is a continuation of CSHARP-2592 (Support for .Net Standard 2.0)



 Comments   
Comment by Uğur Pelister [ 20/Jun/20 ]

ToString() could also be optimized with Span. Current implementation creates a temporary char array just for the sake of providing string constructor's input. This is not the optimal implementation for such a frequently used method.

Comment by KUO HSUAN [ 26/Sep/19 ]

Side note : You can have Span<T> support even with current supported standard (.net standard 1.5)
I can start working on it, if this is accepted

Generated at Wed Feb 07 21:43:28 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.