Fastest JSON Reader / Writer for C ++

I need a C ++ JSON parser and writer. Speed ​​and reliability are very important, I don’t care if the interface is good or not, if it is based on Boost or not, even the C parser is excellent (if it is much faster than C ++).

If anyone has experience with the speed of JSON parsers available, please let us know.

+48
c ++ json c
Aug 18 2018-10-18T00:
source share
3 answers

http://lloyd.github.com/yajl/

http://www.digip.org/jansson/

I don’t know how they are compared in speed, but the first one looks like the right idea for scaling really big JSON data, since it only analyzes a small piece at a time, so they don’t need to keep all the data in memory at once (this can be faster or slower depending from library / use case)

+10
Aug 18 '10 at 14:01
source share
— -

rapidjson is a C ++ JSON parser / generator designed for fast and small memory usage.

There is a comparison with YAJL and JsonCPP.




Update:

I created an open source JSON source test project that evaluates 29 (and increasing) C / C ++ JSON libraries in terms of compliance and presentation. This should be a useful link.

+79
Nov 14 '12 at 9:30
source share

https://github.com/quartzjer/js0n

A carbon-friendly interface is possible, but does what you ask for. Zero distributions.

http://zserge.com/jsmn.html Another approach with zero distribution.

The solutions placed above all occupy the dynamic memory allocation, so at some point they inevitably turn out to be slower, depending on the data structure, and will be dangerous to include in an environment with a limited heap, for example, an embedded system.

The vjson, rapidjson and sajson tests are here: http://chadaustin.me/2013/01/json-parser-benchmarking/ if you are interested in such a thing.

And to answer your "author" part of the question, I doubt that you could win an effective

printf("{%s:%s}",name,value) 

with any library - provided that the printf / sprintf implementation itself is easy, of course.

EDIT: actually let me take this back, RapidJson only allows stack distribution through its MemoryPoolAllocator and actually does this by default for its GenericReader. I did not make a comparison, but I would expect it to be more reliable than everything listed here. It also does not have any dependencies, and it does not throw exceptions, which probably make it ultimately suitable for embedded ones. Completely based on the lib header, so it's easy to include anywhere.

+6
Aug 11 '13 at 16:27
source share



All Articles