3 ms·
People keep saying nlohmann json is defacto for C++, but it’s literally the worst performer out of any C++ json offering.
by secondcoming 3y ago
People keep saying nlohmann json is defacto for C++, but it’s literally the worst performer out of any C++ json offering.
- jpc0 3y agoYou are using JSON. Performance stopped being an option about 3 decisions before choosing Nlohmann. If you cared about performance a JSON parser isn't on your list and if it is it's a relatively minor part of the product stack so once again, use the thing that works and is popular. If your primary means of communication is JSON you are likely optimising a little too hard if you are looking for the most performant parser implementation, good enough is good enough there. If you want performance pick a different format.
- secondcoming 3y agoNot really. The entire adtech industry revolves around passing trillions of json messages around.
- jpc0 3y agoYou are proving my point here. The single largest contributor to performance degradation on websites is that very industry. Look JSON has it's advantages and is a fine tradeoff, performance isn't a place it's good at, that's not something that makes it a bad format, it's just if you want to optimise for performance I would start by reducing the sheer amount of redundant data being passed around in a JSON blob long before I would hyper optimise on a C++ JSON parser. Sure if you are using a JS or python json parser there are massive gains to be had by calling into a lower level language to do the parsing but picking between the choices in C++ parsers is probably bikeshedding. Now if your use case truely needs to absolute most performant JSON parser and you will trade off usability and portability for it then sure but another one of hose axioms apply. The solution for the 99th percentile is rarely the correct solution for the 50th percentile