nativejson-benchmark
nativejson-benchmark copied to clipboard
Add more JSON libaries
- [x] Nlohmann's JSON for Modern C++ C++11 (gcc/clang only)
- [x] JSON Voorhees C++11
- [x] jsoncons C++11
- [x] sajson C++11, parser only
- [x] ArduinoJson
- [x] jeayeson C++14
- [x] nbsdx/SimpleJSON C++11. The project name conflicts with existing MJPA/SimpleJSON.
- [x] Jzon
Above released in v1.0.0
- [x] Sheredom/json.h (C)
- [x] JSON support in POCO
- [x] JSON in Folly
- [x] JSON support in Qt5
sajson was added in https://github.com/miloyip/nativejson-benchmark/tree/sajson branch but it is unable to parse twitter.json. Reported as https://github.com/chadaustin/sajson/issues/7.
Confirmed it is fixed.
JSON Voorhees fails to compile on 32-bit target. Reported as https://github.com/tgockel/json-voorhees/issues/53.
ArduinoJson was added in https://github.com/miloyip/nativejson-benchmark/tree/ArduinoJson branch. But it cannot parse properly due to stack overflow. Reported as https://github.com/bblanchon/ArduinoJson/issues/65.
Confirmed it is fixed.
nbsdx/SimpleJSON was added but there seems no way to iterate object and array. Reported as https://github.com/nbsdx/SimpleJSON/issues/1.
Update:The functions were added. And statistics has been completed.
jbson seems not working widely:
Requires codecvt header (C++11, missing in gcc-4.8 & gcc-4.9 stdlib), various template aliases (C++14), probably more where gcc's stdlib is behind on the standard. Known only to work with an up-to-date libc++ currently.
Thus not add it at this moment.
ArduinoJson crashes when printing big number in conformance test. Reported as https://github.com/bblanchon/ArduinoJson/issues/67.
@miloyip as a notice the Nlohmann/json has released v1.0.0, 16 days ago and would be worth to update. (Crossref: https://github.com/nlohmann/json/issues/177)
@miloyip hello, I want to find a pure C, easy to use and intergrated json library, I found these:
- https://github.com/sheredom/json.h
- https://github.com/vurtun/mmx/blob/master/mm_json.h
maybe these can be added into benchmark, I found libraries here, Thanks for these good results :-)
Homepage: http://zserge.com/jsmn.html Code: https://github.com/zserge/jsmn
FEATURES
- simple
- highly portable (tested on x86/amd64, ARM, AVR)
- compatible with C89
- no dependencies (even libc!)
- no dynamic memory allocation
- extremely small code footprint - it’s just about 200 LOC
- API has only 2 functions
- incremental single-pass parsing
- library code is covered with tests
@miloyip, thanks for updating nlohmann/json to 1.0.0. Is there a way to have a look at the new results?
@nlohmann I will rerun the benchmarks after adding a few more libraries. You may also run it locally as well.
@miloyip is there no way to automate running the benchmarks with continues integration. E.g Travis CI ?
@xor-gate Ideally of course that will be the best. However, do you know any free service can provide stable performance environment? Travis does not guarantee what build machine will be used, and how many concurrent builds (other users) will be running.
You are right about that, I have overseen this. But a colleague tried to run the tests but he could not get it to work. Maybe a alternative would be to have the test suite executable automatically build under Docker. With a Dockerfile supplied, e.g Debian Jessie as base image then people can easy reproduce binaries and run on real metal.
I understand there is difficult to build and run the tests. I faced these problems often as well. The docker idea seems interesting. I have not tried docker before, not sure if there is potential problems. Ideally the dockerfile is built in CI to make it always up-to-date. If you can help on trying this it will be great.
@miloyip I will open a separate issue for this so we when I need some help we can discus there. I will give it a shot this weekend.
@starwing json.h done
@starwing There are some issues when integrating MMX https://github.com/vurtun/mmx/issues/3
@starwing Sigh... the author of mmx has removed the mm_json.h. I think I have not provoked him anyway https://github.com/vurtun/mmx/issues/3
Hey @miloyip, today I released version 1.1.0 of JSON for Modern C++. It would be great if you could update it in your benchmark.
This release also fixes some bugs that have been detected with your floating-point tests. :-)
@nlohmann It's done. BTW, I just added a FAQ for updating libraries. Welcome for updating it via pull request. Good to know this test has helped improving your library :smile:
@miloyip so sad things :(
But still very thank you for the work!!
@miloyip do you think FlatBuffers may have a place in your benchmark ?
In my opinion, this is a different format (just like MessagePack, Protocol Buffers, BSON) and should not be added to the nativejson-benchmark. As the name contains ... json.
@xor-gate FlatBuffers can Parse JSON so maybe in some part of the benchmark this lib may be compared to the others
That make sense, I was not aware of that.
Please add js0n.
Please add zzzJSON
Related requests #113 (simdjson) and #118 (Boost/Beast JSON)
@miloyip, please add yyjson. This one seems to be the fastest json lib (faster than simdjson for large json files I process in my project)