Skip to content

Commit

Permalink
Optimized CborReader.ReadDataItem (#128)
Browse files Browse the repository at this point in the history
Fix #126
  • Loading branch information
mcatanzariti committed Apr 6, 2024
1 parent 8879e0a commit 87ce05a
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/Dahomey.Cbor/Serialization/CborReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -786,9 +786,7 @@ public ReadOnlySpan<byte> ReadDataItem()

int size = _currentPos - currentDataItemPos;

var buffer = new byte[size];
_buffer.Slice(currentDataItemPos, size).CopyTo(buffer);
return new ReadOnlySpan<byte>(buffer);
return _buffer.Slice(currentDataItemPos, size);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand Down

0 comments on commit 87ce05a

Please sign in to comment.