Show HN: Nino – Fastest C# serializer, safe on untrusted input, also TS/Go/Rust ...

@show

Show HN: Nino – Fastest C# serializer, safe on untrusted input, also TS/Go/Rust github.com · 3 points · 0 comments · HN thread

TL;DR Nino is a source-generated binary serializer for C# (prerelease v4) that the author claims is the fastest for .NET, with benchmarks against MemoryPack 1.21.4 showing 3.5–7.2x faster serialization and 1.7–2.1x faster deserialization for classes and polymorphic types. It is designed to safely parse untrusted input and produces the same byte format across .NET, Unity, Godot, TypeScript, Go and Rust. The story was posted as a Show HN with 3 points and no comments.

  • Source generator writes serialization code at compile time with no reflection, so it works on IL2CPP, NativeAOT and HybridCLR.
  • Benchmarks run on GitHub runners with BenchmarkDotNet 0.15.8 show serialization 3.5–7.2x faster and deserialization 1.7–2.1x faster than MemoryPack 1.21.4 for classes and polymorphic types; struct arrays are on par.
  • Deserializing into existing objects allocates nothing, and pooled types are supported.
  • Built for untrusted input: lengths checked before allocation, bounded depth, hash flooding limits, fuzzing in CI, and all invalid input throws one NinoDataException.
  • Trade-offs include positional format by default (VersionTolerant or Keyed needed for evolving stored data), a 4-byte type id on polymorphic values, no System.Type support, and a need for C# 9 and Roslyn 4.3+.
  • v4 is a prerelease and its binary format is incompatible with v3; installing requires the --prerelease flag on NuGet.

Links in the post

  • .NET Benchmarks: Full benchmark tables comparing Nino v4 with v3, MemoryPack, MessagePack and protobuf-net, with methodology and reproduction steps.
  • The fastest binary serializer for C#: Project landing page covering features, platforms, installation commands, use cases and FAQ.

Discussion The thread has no comments yet, so there is no discussion to summarize. The submission has only its initial score of 3 points.

#csharp #serialization #dotnet #benchmarks #binaryFormat #showHN