Replace json11 with RapidJSON
Hi,
I've read rationales.md but couldn't find a reference why using json11. When I check their repo I notice that they don't have active development, pull requests from 2014 linger there and https://github.com/dropbox/json11/issues/41 seems like they have performance issues. We like to use ppconsul but json11 from the benchmarks seems unreliable. I wanted to ask you if you had any reasons to choose json11? Thanks.
Hi,
There was only one reason for json11 library: a simple and convenient C++ API. Btw, that project was more alive at the time I've started to use it. Now it's really not improving. And true, its performance sucks comparing to RapidJSON and other highly optimized JSON libraries. I've already thought about switching to another JSON library but there was other more important things to do and also nobody complained about json11. So now is the time to switch :) I need to finish adding of HTTPS support for ppconsul then I can get rid of json11 in favor of a better alternative like RapidJSON or some other with comparable performance and quality.
For HTTPS support have you looked at the Requests C++ library: https://github.com/whoshuu/cpr
I found a good description of it here: https://www.youtube.com/watch?v=f_D-wD1EmWk
I suggest using nlohmann/json instead. It's more modern, still maintained and pretty much as fast as rapidjson now.
As I know, nlohmann is much slower: https://github.com/miloyip/nativejson-benchmark and it does not support stream writing (correct me if I’m wrong), which means that user has always create an intermediate DOM (json object for nlohmann) and then serialize it to string. RapidJSON is also mucho better battle tested. So I think ppconsul should use rapidjson.
Have you seen boost.json? It seems that it has a good performance and also quite modern,
Never used it myself nor have I seen it being used in other projects. Rapidjson/nlohmann feels like an industry standard at this point with the first used for more speed and the second for more convenience and readability. Oh, and there is also a json parser in boost.property_tree (i guess boost.json is another thing).
The json parser in property tree is a joke. unsuitable for anything serious.
The json parser in property tree is a joke. unsuitable for anything serious.
Absolutely