MsgPack.Light is a lightweight MsgPack serialization library.
- Performance
- .Net core compatability
- Extensibility
- Simple usage
Simpliest way to start using ProGaudi.MsgPack.Light is to install it from NuGet.
var bytes = MsgPackSerializer.Serialize(value);
var value = MsgPackSerializer.Deserialize<string>(bytes);
If you want to work with your own types, first thing you need - type converter. Example of Beer type converter you can find here. Then you should create create MsgPackContext and register your converter:
var context= new MsgPackContext();
context.RegisterConverter(new BeerConverter());
And then you can serialize:
var bytes = MsgPackSerializer.Serialize(beer, context);
And deserialize:
var beer = MsgPackSerializer.Deserialize<Beer>(bytes, context);
To build MsgPack.Light you have to install dotnet SDK version 1.0.0-preview4-004233
or higher (you can find corresponding build on dotnet/cli project.
After dotnet is installed, run following commands:
git clone https://github.com/progaudi/MsgPack.Light.git
cd MsgPack.Light
dotnet build -c Release -f netstandard1.4 src/msgpack.light/msgpack.light.csproj
dotnet build -c Release -f netcoreapp1.1 tests/msgpack.light.tests/msgpack.light.tests.csproj
dotnet test -c Release --no-build tests/msgpack.light.tests/msgpack.light.tests.csproj
MsgPack.Light should built and all test should be passed.
- Serialization performance is comparable with msgpack.cli
- Deserialization performance 2-3 times faster
- MsgPack.Light works best if a data reside a memory (_*Array benchmarks).
- Perfoming some IO operations, performance is suboptimal, but comparable with MsgPack.Cli (*_Stream benchmarks).
- More details can be found here.
- Benchmark data copied from thekvs cpp-serializers project.
- Other benchmarks got from maximn SerializationPerformanceTest_CSharp project.
- Thanks to MessagePack for CLI authors for inspiration.
- Code-generator for field-based converters, we will support array and map modes.
- Possible optimizations with IO handling and asyncing our API.
Linux and OSX build status (it's not possible to separate build status per OS, so if any OS is failing build status will be failing):