Serialization Benchmarks

Read time 2 minutes
On this page

Nalix features a custom binary serialization engine, LiteSerializer, designed for maximum throughput and minimal allocation in high-performance network transport.

LiteSerializer Performance

Detailed micro-benchmarks of standard serialization operations, including unmanaged structs, custom formatters, inline span fills, and formatter resolving.

MethodMeanErrorStdDevP95Gen0Gen1Gen2Allocated
Serialize_Unmanaged_Small8.4605 ns0.3905 ns0.5214 ns9.1123 ns0.0015--56 B
Serialize_Unmanaged_Large49.7401 ns1.3714 ns1.7831 ns52.4651 ns0.0144--536 B
Deserialize_Unmanaged_Small3.3755 ns0.0330 ns0.0441 ns3.4550 ns---0 B
Deserialize_Unmanaged_Large22.0984 ns0.2677 ns0.3083 ns22.6873 ns---0 B
Serialize_Formatter58.3652 ns2.3481 ns2.6099 ns60.5600 ns0.0041--152 B
Deserialize_Formatter60.4312 ns0.7158 ns0.9556 ns62.0313 ns0.0079--296 B
Fill_IntoSpan_Small1.0629 ns0.0188 ns0.0245 ns1.1034 ns---0 B
Fill_IntoSpan_Large5.1200 ns0.0450 ns0.0585 ns5.2316 ns---0 B
Resolve_Formatter0.9009 ns0.0128 ns0.0162 ns0.9219 ns---0 B

Why Nalix Serialization?

  • Zero-Allocation Deserialization: Deserialization of unmanaged structures (Deserialize_Unmanaged_Small and Deserialize_Unmanaged_Large) is fully allocation-free (0 B) and runs in single-digit to low double-digit nanoseconds.
  • Fast Path Span Fills: Copying primitive data directly into target spans (Fill_IntoSpan_Small) takes approximately 1 nanosecond (~1.06 ns) with zero overhead.
  • Direct Memory Blitting: For unmanaged structs, LiteSerializer uses low-level memory block copying via the Unsafe class, producing CPU instructions that operate at raw hardware limits.
  • Aggressive Inlining: Key methods in the serialization path are decorated with aggressive compilation attributes, allowing RyuJIT to inline and optimize out method call overhead.