MessagePack for C#(.NET, .NET Core, Unity, Xamarin)

I’ve released new MessagePack implementation — MessagePack for C#

This new library achieved extremely fast serialization/deserialization and serialized binary size.

MessagePack for C# is always fast, optimized for all types(primitive, small struct, large object, any collections). And embedded LZ4 compression support is fully satisfied both performance and binary size.

C# MessagePack implemantion is already exists — MsgPack-Cli, but I was dissatisfied with the performance. Six months ago, I made a serializer called ZeroFormatter. Its performance is very fast and supports infinitely fast deserializer like Google’s FlatBuffers.

For several reasons, I needed a serializer other than ZeroFormatter. One is implementing real-time network communication in games, which means that one data is not large, but it is frequent. It did not take advantage of the infinitely fast deserializer, small binary size and the small memory useage were more important.

I noticed that ZeroFormatter Serializer Architecture can also be applied to MessagePack. It succeeded, achieved MessagePack ‘s compact binary size, cross -platform, and performance.

Also, the LZ4 integration is powerful! Compression and speed were achieved by building in the serializer and tuning each other optimally.

For Unity, I prepared an unsafe mode which can serialize/deserialize Vector3[] in 20 times faster than JsonUtility. It should be very useful for transferring large meshes and coordinates. My company is also working on VR and Hololens development(our company’s first VR/AR Application — Project Sonata and our VR Studio), so fast serialization is important.

This is the ultimate general purpose serializer in C#. You do not have to worry about choosing a binary serializer anymore! What about ZeroFormatter? If need infinite fast deserializer so read/transfer large amounts of data without parsing on the spot, it is very useful. Otherwise, MessagePack for C# would be good choise.

I am creating two new libraries that use MessagePack for C#.

MasterMemory is a readonly in-memory document database. Data can query at a 300x faster than SQLite. It is suitable for master data management(read-heavy and less-write). I’m using on role-playing game’s data query that made by Unity for iOS/Android.

MagicOnion is a gRPC based HTTP/2 RPC Streaming Framework. Goodbye, REST. Goodbye, ASP.NET. Goodbye, SignalR. gRPC is the perfect solution to replace everything. However, if it only supports C#, I could do more better. It is MagicOnion. No more .proto, it is completly unnecessary! If you write C#, it is typed and you call safely! And MessagePack (and LZ4 integration) is the best match for such communication.

MagicOnion is still under development, please look forward to it. Preview version is released on NuGet, please try and tell me your impressions. Let’s grow up together.

Written by

a.k.a. neuecc. Creator of UniRx, UniTask, MessagePack for C#, MagicOnion etc. Microsoft MVP for C#. CEO/CTO of Cysharp Inc. Live and work in Tokyo, Japan.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store