File tree Expand file tree Collapse file tree
SerializerBenchmarks.UnitTests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ public class AsyncSerializerTests
2525 [ InlineData ( typeof ( XmlSerializer < DataItem > ) ) ]
2626 [ InlineData ( typeof ( NewtonsoftJson < DataItem > ) ) ]
2727 [ InlineData ( typeof ( MsgPackCli < DataItem > ) ) ]
28+ [ InlineData ( typeof ( MsgPackCliDefaultAsync < DataItem > ) ) ]
2829 [ InlineData ( typeof ( SystemTextJson < DataItem > ) ) ]
2930#if ( NET6_0_OR_GREATER )
3031 [ InlineData ( typeof ( MemoryPack < DataItem > ) ) ]
@@ -73,6 +74,7 @@ public async Task SerializeAsyncTest(Type serializerType)
7374 [ InlineData ( typeof ( XmlSerializer < DataItem > ) ) ]
7475 [ InlineData ( typeof ( NewtonsoftJson < DataItem > ) ) ]
7576 [ InlineData ( typeof ( MsgPackCli < DataItem > ) ) ]
77+ [ InlineData ( typeof ( MsgPackCliDefaultAsync < DataItem > ) ) ]
7678 [ InlineData ( typeof ( SystemTextJson < DataItem > ) ) ]
7779#if ( NET6_0_OR_GREATER )
7880 [ InlineData ( typeof ( MemoryPack < DataItem > ) ) ]
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ public void SetupTest()
3838 [ InlineData ( typeof ( XmlSerializer < DataItem > ) ) ]
3939 [ InlineData ( typeof ( NewtonsoftJson < DataItem > ) ) ]
4040 [ InlineData ( typeof ( MsgPackCli < DataItem > ) ) ]
41+ [ InlineData ( typeof ( MsgPackCliDefaultAsync < DataItem > ) ) ]
4142 [ InlineData ( typeof ( SystemTextJson < DataItem > ) ) ]
4243#if ( NET6_0_OR_GREATER )
4344 [ InlineData ( typeof ( MemoryPack < DataItem > ) ) ]
@@ -78,6 +79,7 @@ public void SerializeTest(Type serializerType)
7879 [ InlineData ( typeof ( XmlSerializer < DataItem > ) ) ]
7980 [ InlineData ( typeof ( NewtonsoftJson < DataItem > ) ) ]
8081 [ InlineData ( typeof ( MsgPackCli < DataItem > ) ) ]
82+ [ InlineData ( typeof ( MsgPackCliDefaultAsync < DataItem > ) ) ]
8183 [ InlineData ( typeof ( SystemTextJson < DataItem > ) ) ]
8284#if ( NET6_0_OR_GREATER )
8385 [ InlineData ( typeof ( MemoryPack < DataItem > ) ) ]
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ public class SerializerTests
2525 [ InlineData ( typeof ( XmlSerializer < DataItem > ) ) ]
2626 [ InlineData ( typeof ( NewtonsoftJson < DataItem > ) ) ]
2727 [ InlineData ( typeof ( MsgPackCli < DataItem > ) ) ]
28+ [ InlineData ( typeof ( MsgPackCliDefaultAsync < DataItem > ) ) ]
2829 [ InlineData ( typeof ( SystemTextJson < DataItem > ) ) ]
2930#if ( NET6_0_OR_GREATER )
3031 [ InlineData ( typeof ( MemoryPack < DataItem > ) ) ]
@@ -73,6 +74,7 @@ public void SerializeTest(Type serializerType)
7374 [ InlineData ( typeof ( XmlSerializer < DataItem > ) ) ]
7475 [ InlineData ( typeof ( NewtonsoftJson < DataItem > ) ) ]
7576 [ InlineData ( typeof ( MsgPackCli < DataItem > ) ) ]
77+ [ InlineData ( typeof ( MsgPackCliDefaultAsync < DataItem > ) ) ]
7678 [ InlineData ( typeof ( SystemTextJson < DataItem > ) ) ]
7779#if ( NET6_0_OR_GREATER )
7880 [ InlineData ( typeof ( MemoryPack < DataItem > ) ) ]
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ public class AsyncBenchmarks
4141 typeof ( XmlSerializer < DataItem > ) ,
4242 typeof ( NewtonsoftJson < DataItem > ) ,
4343 typeof ( MsgPackCli < DataItem > ) ,
44+ typeof ( MsgPackCliDefaultAsync < DataItem > ) ,
4445 typeof ( SystemTextJson < DataItem > )
4546#if ( NET6_0_OR_GREATER )
4647 , typeof ( MemoryPack < DataItem > ) ,
Original file line number Diff line number Diff line change 1+ using MsgPack . Serialization ;
2+ using SerializersBenchmark . Base ;
3+
4+ namespace SerializersBenchmark . Serializers ;
5+
6+ public class MsgPackCliDefaultAsync < T > ( Func < int , T > testDataStrategy ) : TestBase < T > ( testDataStrategy )
7+ where T : class
8+ {
9+ private MessagePackSerializer Serializer { get ; } = MessagePackSerializer . Get < T > ( ) ;
10+
11+ public override MemoryStream Serialize ( object obj )
12+ {
13+ var stream = new MemoryStream ( ) ;
14+ Serializer . Pack ( stream , obj ) ;
15+ return stream ;
16+ }
17+
18+ public override object Deserialize ( MemoryStream stream )
19+ {
20+ return ( T ) Serializer . Unpack ( stream ) ;
21+ }
22+ }
You can’t perform that action at this time.
0 commit comments