-
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathBinaryBenchmark.MemoryPack.cs
More file actions
23 lines (20 loc) · 764 Bytes
/
Copy pathBinaryBenchmark.MemoryPack.cs
File metadata and controls
23 lines (20 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
using BenchmarkDotNet.Attributes;
using MemoryPack;
using SerializationBenchmarks.Models;
public partial class BinaryBenchmark
{
[Benchmark, BenchmarkCategory("Serialization", "Binary"), ArgumentsSource(nameof(GenerateDataSets))]
public byte[] MemoryPack_Serialize(DataSet data)
{
return DataConvert_MemoryPack(data.Payload);
}
[Benchmark, BenchmarkCategory("Deserialization", "Binary"), ArgumentsSource(nameof(GenerateDataSets))]
public List<User> MemoryPack_Deserialize(DataSet data)
{
return MemoryPackSerializer.Deserialize<List<User>>(data.SerializedData.MemoryPack);
}
private byte[] DataConvert_MemoryPack(List<User> users)
{
return MemoryPackSerializer.Serialize(users);
}
}