CryptoBase
CryptoBase copied to clipboard
Using the range operator will result in significant performance loss
using System;
public class X
{
public void A(ref Span<byte> span, int i)
{
span = span[i..];
}
public void B(ref Span<byte> span, int i)
{
span = span.Slice(i);
}
}
; Core CLR 8.0.23.53103 on x64
X..ctor()
L0000: ret
X.A(System.Span`1<Byte> ByRef, Int32)
L0000: sub rsp, 0x28
L0004: mov rax, rdx
L0007: mov eax, [rax+8]
L000a: mov ecx, eax
L000c: sub ecx, r8d
L000f: mov r8d, r8d
L0012: mov r10d, ecx
L0015: add r10, r8
L0018: cmp r10, rax
L001b: ja short L002b
L001d: add r8, [rdx]
L0020: mov [rdx], r8
L0023: mov [rdx+8], ecx
L0026: add rsp, 0x28
L002a: ret
L002b: mov rax, 0x7ffb10a5ead8
L0035: call qword ptr [rax]
L0037: int3
X.B(System.Span`1<Byte> ByRef, Int32)
L0000: sub rsp, 0x28
L0004: mov eax, [rdx+8]
L0007: cmp r8d, eax
L000a: ja short L0020
L000c: mov ecx, r8d
L000f: add rcx, [rdx]
L0012: sub eax, r8d
L0015: mov [rdx], rcx
L0018: mov [rdx+8], eax
L001b: add rsp, 0x28
L001f: ret
L0020: mov rax, 0x7ffb10a5ead8
L002a: call qword ptr [rax]
L002c: int3
So just ignore IDE0057