← Tue, Sep 29 digest

Deser: Rethinking Rust Serialization

read article ↗ hn thread ↗

Armin Ronacher introduced Deser, an alternative Rust serialization library featuring a heap-backed driver-sink architecture designed to fix long-standing Serde limitations.

read it The author provides a deep architectural breakdown of Serde's limitations and presents a concrete, radically different design alternative.

summary

Armin Ronacher introduced Deser, a Rust serialization library designed to address structural limitations in Serde caused by its stack-based recursion and unified data model. By inverting the architecture so formats push events into heap-allocated sinks via a driver, Deser eliminates stack overflow risks, enables stream parsing, and cleanly handles complex structures like XML namespaces and flattened maps. Although it brings binary size tradeoffs and drops support for non-self-describing formats like protobuf, it provides a robust alternative for complex self-describing data. Performance benchmarks indicate mixed runtime overheads but faster derived-code compile times.

key points

  1. Deser uses a heap-backed driver-sink model instead of Serde's recursive visitor pattern, preventing stack overflows and supporting stream parsing.
  2. It directly resolves notorious Serde edge cases including arbitrary precision numbers, map key type conversions under flattening, and XML namespaces.
  3. Runtime performance is mixed—averaging roughly 10% slower for JSON reading—while release compilation times for derived code are roughly 2.3x faster.

who should read it

Rust developers building systems that process complex, nested, or untrusted self-describing formats like JSON, TOML, or XML.

discussion positive

consensus

Commenters briefly noted structural and philosophical similarities to other experimental Rust serialization efforts like facet.

best comment by satvikpendem ↗

How does this compare to facet [0][1] by fasterthanlime? Seems some of the reasoning is similar especially for compile time bloat.

[0] https://facet.rs

[1] https://fasterthanli.me/articles/introducing-facet-reflectio...

Links to a similar experimental Rust reflection and serialization project called facet for comparison.

Generated by an LLM from the article and thread. Check the sources before relying on it.