Our great sponsors
-
ixy-languages
A high-speed network driver written in C, Rust, C++, Go, C#, Java, OCaml, Haskell, Swift, Javascript, and Python
-
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.
First of all, you are comparing some specific libraries/implementations, not programming languages. Theoretically you could always get the same performance using rust. Look at the last section here: https://github.com/ixy-languages/ixy-languages/blob/master/Rust-vs-C-performance.md In their case, the code generated by C2Rust compiled with rustc did actually run even slightly faster than the C code compiled directly using clang.
Of course that doesnt mean that in practice the available libraries are as optimized. Did you try actix? It tends to be faster than rocket. Also json-rust and simd-json are usually faster than serde-json, when you don't deserialize a known structure. Here are some benchmarks: https://github.com/serde-rs/json-benchmark
serde-rs/json#160: Parsing 20MB file using from_reader is slow
...at least, that's what I get from the "Nom may be faster, and Serde faster still, but we're fast enough" chart on pest's website.
I have two suggestions Capnproto, MessagePack (those are only the two examples that came to mind first, i bet there are even one or two especially developed for rust). Both of these are better than json in nearly every way.
I have two suggestions Capnproto, MessagePack (those are only the two examples that came to mind first, i bet there are even one or two especially developed for rust). Both of these are better than json in nearly every way.
Related posts
- Hey Rustaceans! Got a question? Ask here (26/2023)!
- I pre-released my project "json-responder" written in Rust
- Announcing Sonic-rs 0.2.0: Separate safe & unsafe functions clearly and performance optimization.
- Announcing sonic-rs: A fast Rust JSON library based on SIMD.
- A Simple CRUD API in Rust with Cloudflare Workers, Cloudflare KV, and the Rust Router