Our great sponsors
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
A note on performance and size: Some benchmarks and statistics are included in the README. But only because people will be curious. I've based my methodology on rust_serialization_benchmark, but decided to not extend it (for now) since it seems to exclude any Rust types which are not widely supported by all formats being tested (like HashMap's and 128-bit numbers). The test suite is already quite nice if you want to take it for a spin.
A note on performance and size: Some benchmarks and statistics are included in the README. But only because people will be curious. I've based my methodology on rust_serialization_benchmark, but decided to not extend it (for now) since it seems to exclude any Rust types which are not widely supported by all formats being tested (like HashMap's and 128-bit numbers). The test suite is already quite nice if you want to take it for a spin.
And before you ask: This only provides partial zero-copy support in strings and byte arrays like serde. But it's not like rkyv which constructs validated references into the data.
"Borrow heuristics" saves a lot of configuration. It's basically just the macro analyzing the type signature of fields for references and with that it can do the right thing 95% of the time. If those lifetimes weren't there I suspect it would mean having to use a helluvalot of attributes to make up for the lack of markup doing it the other way around (think of cases where there's multiple lifetimes). Unclear how it should work for nested types too, like how you'd want Vec> to be a Vec>. Some strange attribute would be needed I think.
Number parsing uses a fairly naive but uses a lossless algorithm in musli-json. In serde_json they use a fork of lexical I haven't wrapped my head around. I wanted something simple to start with.
Love seeing the work on modes! There's definitely a use for this in cryptography, where you might want to serialize things containing elliptic curve points, which can be serialized in both "compressed" form and "uncompressed" form. We make extensive use of this in our serialization framework in arkworks: https://github.com/arkworks-rs/algebra/tree/master/serialize