msgpack-cli
msgpack-cli copied to clipboard
Serialization performance is very slow in .NET Core
MsgPack-Cli is extremely slow(slower than JSON.NET!) in .NET Core. I think MsgPack-Cli is using reflection based serializer in .NET Core.
public class MyClass
{
public int MyProperty { get; set; }
}
class Program
{
static void Main(string[] args)
{
var serializer = MsgPack.Serialization.SerializationContext.Default.GetSerializer<MyClass>();
// MsgPack.Serialization.ReflectionSerializers.ReflectionObjectMessagePackSerializer`1[[]]
Console.WriteLine(serializer.GetType().FullName);
}
}
Here is csproj, launch VS2017 -> Reference NuGet -> Run.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MsgPack.Cli" Version="0.9.0-beta2" />
</ItemGroup>
</Project>
Same here. I was excited to find this project to improve our performance but wow for larger objects it's as bad as 8x slower to serialize versus JSON.NET...
How large is it? I want to measure and investigate it.
The size of the serialized object's file was 220MB versus 300MB serialized as a json file by JSON.NET. The vast majority of the slowdown for MessagePack is serializing (deserializing is fast). The object format (if it matters) was,
class DataSet {
IDictionary<Guid, Class1> Class1;
IDictionary<Guid, Class2> Class2;
}
class Class1 {
string Property1;
ISet<Guid> Property2;
}
class Class1 {
string Property1;
ISet<Guid> Property2;
Guid Property3;
}
With 1000 Class1 entries and 1000 Class2 entries, with each entry having 1000 guids in Property2.