Repository navigation
Replies: 1 comment
|
On the speed question: yes, nlohmann/json is meaningfully slower than RapidJSON or simdjson, and that's a deliberate trade-off rather than an accident of implementation:
None of that is "SLOW slow" for typical workloads — for a lot of applications (config files, REST payloads, logs) the parser is nowhere near the bottleneck, and the ergonomics win out. But if you're in a hot path, there are a few knobs before you'd need to drop the library entirely:
If you have a concrete benchmark where the gap is a real problem, feel free to share it — profiling a specific case is a lot more actionable than "it's slower." (Text supported by Claude Code) |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
We have some software that was using RapidJSON, and while nothing beats the speed, RapidJSON is not being maintained and no work is done on it all, for years. Sadly there are some CVE's in it, so we were forced to do something. After comparing libraries, we picked nlohmann json. AI was able to convert the code over surprisingly well. And while it is not nearly as fast (where we uses it performance is not critical), we love that it is one file, we had no issues or conflicts bringing it into our code, and it provides a lot of flexibility. We considered simdjson and would have picked it, but it can't serialize or write json. The next best general purpose tool (if you are not using boost which appears would be a great option speedwise), is this nlohmann.
I am curious about the speed differences. I think simdjson and rapidjson use special techniques to parse insanely fast, and while nlohman is much slower, maybe it is not SLOW slow? It uses std classes and I know some of them are very inefficient.
I am curious what you all think about this.
All reactions