// open_source
Serialization Benchmarks
Comprehensive BenchmarkDotNet suite comparing .NET JSON and binary serializers including System.Text.Json, MessagePack, Protobuf, and more
View on GitHubThis repository is a comprehensive benchmark suite comparing .NET serialization libraries across JSON and binary formats. Originally created as part of a YouTube video exploring serializer performance, this repository is open to community contributions for new scenarios and frameworks.
Motivation
Choosing the right serializer can have a dramatic impact on application throughput and memory usage. This project provides reproducible, side-by-side comparisons using BenchmarkDotNet so developers can make informed decisions based on real data rather than assumptions.
Serializers Covered
JSON
- Newtonsoft.Json
- ServiceStack.Text
- SpanJson
- System.Text.Json (with and without Source Generator)
- UTF8Json
Binary
- AvroConvert
- Bebop
- BSON (MongoDB)
- CBOR (Dahomey)
- GroBuf
- Hyperion
- MessagePack
- MemoryPack
- MsgPack
- protobuf-net
Key Findings (.NET 10)
Benchmarks run across small, medium, and large datasets reveal clear performance tiers:
Binary serialization (deserialization, small dataset):
- MemoryPack leads at ~59us with 264KB allocated
- Bebop follows closely at ~69us
- GroBuf rounds out the top three at ~88us
JSON serialization (deserialization, small dataset):
- SpanJson is fastest at ~305us
- UTF8Json at ~364us
- System.Text.Json Source Gen at ~406us
Serialize leaders (binary, small dataset):
- MemoryPack at ~30us
- GroBuf at ~53us
- Bebop at ~65us with zero allocations
Performance gaps widen significantly at larger dataset sizes, making serializer choice increasingly important for high-throughput scenarios.
Running Locally
dotnet run -c Release --project src/SerializationBenchmarksResults are generated as BenchmarkDotNet reports in the BenchmarkDotNet.Artifacts directory.