mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-19 19:13:11 +08:00
Merge pull request #880 from xljiulang/master
Reduce the performance cost of Memory<T>.getSpan()
This commit is contained in:
@@ -80,7 +80,7 @@ namespace MQTTnet.AspNetCore
|
|||||||
headerLength = 0;
|
headerLength = 0;
|
||||||
bodyLength = 0;
|
bodyLength = 0;
|
||||||
|
|
||||||
var temp = input.Slice(0, Math.Min(5, input.Length)).GetMemory();
|
var temp = input.Slice(0, Math.Min(5, input.Length)).GetMemory().Span;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@@ -88,7 +88,7 @@ namespace MQTTnet.AspNetCore
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
encodedByte = temp.Span[index];
|
encodedByte = temp[index];
|
||||||
index++;
|
index++;
|
||||||
|
|
||||||
value += (byte)(encodedByte & 127) * multiplier;
|
value += (byte)(encodedByte & 127) * multiplier;
|
||||||
|
|||||||
Reference in New Issue
Block a user