Benchmark for execution test written

This commit is contained in:
2025-08-07 23:39:42 +03:00
parent 0f355b9df3
commit c29db73a0e
12 changed files with 237 additions and 28 deletions
+15 -2
View File
@@ -19,12 +19,12 @@ public static class CborExtensions
MemoryMarshal.Write(span, ref id);
writer.WriteByteString(span);
}
public static void WriteToDest(this RequestId id, Span<byte> destination)
{
MemoryMarshal.Write(destination, ref id);
}
[MethodImpl(MethodImplOptions.AggressiveOptimization)]
public static unsafe void WriteToCborOpt(this RequestId id, CborWriter writer)
{
@@ -32,4 +32,17 @@ public static class CborExtensions
MemoryMarshal.Write(span, ref id);
writer.WriteByteString(span);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static RequestId ReadFromTrueCbor(CborReader reader)
{
var enc = reader.ReadEncodedValue(true);
return MemoryMarshal.Read<RequestId>(enc.Span[1..]);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static RequestId ReadFromCbor(CborReader reader)
{
var enc = reader.ReadEncodedValue();
return MemoryMarshal.Read<RequestId>(enc.Span[1..]);
}
}