PyYoshi/JsonBenchmarkCpp

Benchmark of JSON frameworks in c++

★ 0Forks 0C++GitHub ↗Compare

README

JsonBenchmarkCpp

JsonBenchmarkCpp is a small program to benchmark various JSON
frameworks in c++

Currently supports following libs,

  1. Cajun
  2. json_spirit
  3. libjson
  4. json-parser
  5. AveryWs js
  6. json11
  7. picojson
  8. rapidjson

See my blog post for details.

Building

  1. Install git
  2. git clone git://github.com/lijoantony/JsonBenchmarkCpp.git
  3. Edit main.cpp to suit your needs
  4. Either edit the Makefile as you like and use make to build the executable
    or use your favourite build system to compile and link main.cpp with the libs.

Results Summary

Frameworks ranked in the order libjson, json_spirit and Cajun for both parsing and writing speeds

Eg:

$./JsonBenchmarkCpp > results.dat
averydb@debian:~/gits/JsonBenchmarkCpp$ cat results.dat
#library                 parsing                  writing
cajun                    420                      59
json_spirit              4739                     1498
libjson                  215                      144
json_parser              105
json11                   145                      36
picojson                 164                      35
rapidjson                44                       21

Here the numbers shows time taken by each lib for the particular operation in microseconds.
libjson is a clear winner among the three.
Sample results and corresponding graphs are available in results directory.
For accurate results, replace the content of file data.json with your JSON data and run the executable.

Use the gnuplot script results/graph.p to draw bar diagram out of this data:

$ ./graph.p > graph.png

Thanks

Thanks to the library authors for their effort and time.
You saved me from reinventing the same wheel again!

Special thanks to Jonathan Wallace, for actively developing libjson and helping me with my queries.

Contributors

lijoantonyPyYoshijoshkelmatthewaveryusa

Issues