MemoryPack
Zero encoding extreme performance binary serializer for C# and Unity.
MemoryPack is a C# library that converts objects to bytes and back again, a process called serialization. It is built specifically for speed, and its benchmark results show it running ten times faster than the widely-used System.Text.Json library for typical objects and fifty to two hundred times faster for arrays of simple data types like numbers. The author previously built other popular C# serializers, and MemoryPack represents their fourth attempt, this time designed from the ground up around features introduced in .NET 7 and C# 11.
The core idea behind its speed is what the README calls zero-encoding: rather than converting data into an intermediate format with extra tags and length markers the way most serializers do, MemoryPack copies the raw memory layout of C# objects directly into the output bytes when possible. This works especially well for arrays of plain numeric or value types, which are already stored in memory in a flat, compact way. For more complex objects the library uses code generation, meaning it writes specialized serialization code at compile time rather than figuring out what to do at runtime through reflection. This avoids a common performance cost that other libraries pay every time they run.
Setting it up is straightforward for developers. You add the NuGet package, mark your class or struct with a MemoryPackable attribute, and call two methods to serialize and deserialize. The library supports a wide range of built-in types including all standard collections, dictionaries, date and time types, and common .NET value types. It also handles more advanced scenarios like polymorphism (where a field can hold different object types), circular references within object graphs, version tolerance so older and newer data formats can coexist, and streaming for processing data in chunks.
The library also supports Unity game development through the IL2CPP compilation path, and it can generate TypeScript type definitions and an ASP.NET Core formatter for use in web APIs.
The full README is longer than what was shown.