[Smtk-developers] JSON in SMTK

Ben Boeckel ben.boeckel at kitware.com
Tue Sep 12 10:38:44 EDT 2017


On Mon, Sep 11, 2017 at 18:24:46 -0400, David Thompson wrote:
> @Ben jsoncpp is really terrible:
> + it is not concise to use (I'm not sure nlohmann is either because it lives
in the "nlohmann" namespace);

What do you mean by "concise"?

> + it is slow -- see
> https://github.com/miloyip/nativejson-benchmark#parsing-time where
> cJSON takes 25ms and jsoncpp takes 166ms; nlohmann takes 71 ms which
> is not great but look at how easy it is to use; and

Those results are from 2015 which I'll considere "out of date" to say the
least. I'm running it again today. Even so, is performance that much of an
issue? I'm more worried about the maintenance side. If it isn't jsoncpp,
someone else needs to do the mangling and preparation of the library for
inclusion.

> + it is heavy (243k-LOC vs 42k for nlohmann and 27k for cJSON)

I suspect that's a naive count. In VTK, it is alagamated into a single
file:

    % sloccount ThirdParty/jsoncpp/vtkjsoncpp
    Creating filelist for vtkjsoncpp
    Categorizing files.
    Finding a working MD5 command....
    Found a working MD5 command.
    Computing results.


    SLOC    Directory       SLOC-by-Language (Sorted)
    5464    vtkjsoncpp      cpp=5464


    Totals grouped by language (dominant language first):
    cpp:           5464 (100.00%)

> We should help move CMake/VTK away from jsoncpp instead of designing
> software by seniority.

CMake can move whenever; it doesn't have it in its API. VTK is harder.
FWIW, ITK is also using jsoncpp.

--Ben


More information about the Smtk-developers mailing list