Our great sponsors
-
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.
-
json_typegen
Tools and libraries to create types for Rust, Kotlin, TypeScript and Python from JSON samples
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.
Finally, there are parsers specifically tuned to only getting a single key as fast as possible.
You can use https://github.com/evestera/json_typegen directly, that’s what the website uses internally
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.