Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-2391

Provide an overload for JsonWriter.WriteValue to accept Span<byte> input

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Backlog
    • Minor - P4
    • Resolution: Unresolved
    • 2.7.0
    • None
    • BSON, Json, Performance
    • None
    • Fully Compatible

    Description

      The recently introduced Span<T> offers advantages, specifically obviating the need to deal with byte buffers in most cases. I started to use it in my code, too, but the C# driver's JsonWriter.WriteValue method won't accept Span<byte> and a span has to be converted to a byte array first, which results in a heap allocation: span.ToArray().

      The driver should support this new .NET type so that we can use it without such unnecessary allocation penalties.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ugur.pelister@outlook.com Uğur Pelister
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: