Skip to content

Commit 10955cc

Browse files
authored
Merge pull request MessagePack-CSharp#1478 from AArnott/nongenericperftests
Add non-generic serialize/deserialize perf tests
2 parents 541ad7c + 37e2dbc commit 10955cc

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

sandbox/PerfBenchmarkDotNet/DeserializeBenchmark.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) All contributors. All rights reserved.
1+
// Copyright (c) All contributors. All rights reserved.
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

44
extern alias newmsgpack;
@@ -60,6 +60,12 @@ public IntKeySerializerTarget IntKey()
6060
return newmsgpack.MessagePack.MessagePackSerializer.Deserialize<IntKeySerializerTarget>(intObj);
6161
}
6262

63+
[Benchmark]
64+
public IntKeySerializerTarget IntKey_NonGeneric()
65+
{
66+
return (IntKeySerializerTarget)newmsgpack.MessagePack.MessagePackSerializer.Deserialize(typeof(IntKeySerializerTarget), intObj);
67+
}
68+
6369
[Benchmark]
6470
public StringKeySerializerTarget StringKey()
6571
{

sandbox/PerfBenchmarkDotNet/SerializeBenchmark.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) All contributors. All rights reserved.
1+
// Copyright (c) All contributors. All rights reserved.
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

44
extern alias newmsgpack;
@@ -35,6 +35,12 @@ public byte[] IntKey()
3535
return newmsgpack.MessagePack.MessagePackSerializer.Serialize<IntKeySerializerTarget>(intData);
3636
}
3737

38+
[Benchmark]
39+
public byte[] IntKey_NonGeneric()
40+
{
41+
return newmsgpack.MessagePack.MessagePackSerializer.Serialize(typeof(IntKeySerializerTarget), intData);
42+
}
43+
3844
[Benchmark]
3945
public byte[] StringKey()
4046
{

0 commit comments

Comments
 (0)