MemoryPack: Zero encoding extreme performance binary serializer for C#

https://news.ycombinator.com/rss Hits: 2
Summary

Zero encoding extreme performance binary serializer for C# and Unity. Compared with System.Text.Json, protobuf-net, MessagePack for C#, Orleans.Serialization. Measured by .NET 7 / Ryzen 9 5950X machine. These serializers have IBufferWriter<byte> method, serialized using ArrayBufferWriter<byte> and reused to avoid measure buffer copy. For standard objects, MemoryPack is x10 faster and x2 ~ x5 faster than other binary serializers. For struct array, MemoryPack is even more powerful, with speeds up to x50 ~ x200 greater than other serializers. MemoryPack is my 4th serializer, previously I've created well known serializers, ZeroFormatter, Utf8Json, MessagePack for C#. The reason for MemoryPack's speed is due to its C#-specific, C#-optimized binary format and a well tuned implementation based on my past experience. It is also a completely new design utilizing .NET 7 and C# 11 and the Incremental Source Generator (.NET Standard 2.1 (.NET 5, 6) and there is also Unity support). Other serializers perform many encoding operations such as VarInt encoding, tag, string, etc. MemoryPack format uses a zero-encoding design that copies as much C# memory as possible. Zero-encoding is similar to FlatBuffers, but it doesn't need a special type, MemoryPack's serialization target is POCO. Other than performance, MemoryPack has these features. Support modern I/O APIs (IBufferWriter<byte>, ReadOnlySpan<byte>, ReadOnlySequence<byte>) Native AOT friendly Source Generator based code generation, no Dynamic CodeGen (IL.Emit) Reflectionless non-generics APIs Deserialize into existing instance Polymorphism (Union) serialization Limited version-tolerant (fast/default) and full version-tolerant support Circular reference serialization PipeWriter/Reader based streaming serialization TypeScript code generation and ASP.NET Core Formatter Unity (2021.3) IL2CPP Support via .NET Source Generator This library is distributed via NuGet. For best performance, recommend to use .NET 7. Minimum requirement is ....

First seen: 2026-07-23 00:53

Last seen: 2026-07-23 01:54