Uploaded image for project: 'Couchbase .NET client library'
  1. Couchbase .NET client library
  2. NCBC-1921

Optimize OperationBuilder.Write For MemoryPool On .Net Core 2.0 and Full Framework

    XMLWordPrintable

Details

    • 1

    Description

      On .Net Core 2.0 and Full Framework, Stream doesn't have a ReadOnlySpan<byte> overload. As a result, in OperationBuilder so we're currently copying the entire span to another block of memory on the ArrayPool so we can call Write(byte[], int, int).

      However, when the MemoryPool is used, it's typically backed under the covers by a byte[], and MemoryMarshal.TryGetArray can be used to extract an ArraySegment. Using this can cut out an ArrayPool allocation and a memory copy. We should test for this scenario and optimize for it.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            btburnett3 Brant Burnett
            btburnett3 Brant Burnett
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty