Serde Json vs Rapidjson (Rust vs C++)

This page summarizes the projects mentioned and recommended in the original post on /r/rust

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • json-benchmark

    nativejson-benchmark in Rust

  • But the code OP posted deserializes JSON without knowing anything about the structure, which is known to be slow in serde-json and doesn't appear to be the focus for the library. The json and json-deserializer crates should perform much better in that scenario.

  • pikkr

    JSON parser which picks up values directly without performing tokenization in Rust

  • Finally, there are parsers specifically tuned to only getting a single key as fast as possible.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • json_typegen

    Tools and libraries to create types for Rust, Kotlin, TypeScript and Python from JSON samples

  • You can use https://github.com/evestera/json_typegen directly, that’s what the website uses internally

  • serde_json_borrow

    Fast JSON deserialization on borrowed data

  • The rust version also measures allocation overhead by a lot. The c++ version uses “insitu” parsing which means it prefers “borrowing” over allocating new structures (like for strings). You might wanna add https://github.com/PSeitz/serde_json_borrow to your comparison, iiuc it supports a “Value” which borrows from the input. If that’s too slow for you too, you might wanna take a look at an alternative json parser, eg. https://crates.io/crates/simd-json.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts