ppconsul icon indicating copy to clipboard operation
ppconsul copied to clipboard

Replace json11 with RapidJSON

Open kaskavalci opened this issue 9 years ago • 9 comments

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.

kaskavalci avatar Mar 30 '16 07:03 kaskavalci

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.

oliora avatar Mar 30 '16 11:03 oliora

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

zapbranighan avatar Mar 03 '17 07:03 zapbranighan

rapidjson is a hot C++ json library at this moment.

It's worth taking a look at

lamduy-nguyen avatar Nov 28 '18 10:11 lamduy-nguyen

I suggest using nlohmann/json instead. It's more modern, still maintained and pretty much as fast as rapidjson now.

indev29 avatar Oct 13 '20 15:10 indev29

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.

oliora avatar Oct 13 '20 17:10 oliora

Have you seen boost.json? It seems that it has a good performance and also quite modern,

oliora avatar Oct 13 '20 17:10 oliora

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).

indev29 avatar Oct 13 '20 17:10 indev29

The json parser in property tree is a joke. unsuitable for anything serious.

oliora avatar Oct 13 '20 21:10 oliora

The json parser in property tree is a joke. unsuitable for anything serious.

Absolutely

zhoub avatar Jan 14 '23 05:01 zhoub