-
Hi, has anyone done any comparing benchmarks of this new lib that shows how it performs to other JSON C++ libs? Would be great to see that. |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
In a nutshell, taoJSON (as we will call it) seems to be (one of) the fastest within the class of libraries based on standard containers. Libraries like RapidJSON that use custom (but generic, in the sense of "can store any JSON") data structures can be a lot faster, though taoJSON can also do direct-from/to-standard-and-custom-C++-types which can make up for (part of) the difference. Have you looked at https://github.com/miloyip/nativejson-benchmark yet? |
Beta Was this translation helpful? Give feedback.
-
Thanks, haven't seen this yet. RapidJson is apparently also 100% standard compliant and still faster by factors. But that was in 2016. Wonder how they compare today. |
Beta Was this translation helpful? Give feedback.
-
And taoJSON was the first (still only?) other library to achieve 100% conformance in the nativejson benchmark! |
Beta Was this translation helpful? Give feedback.
-
@patlecat I don't think there were significant changes, although taoJSON might get a little bit faster. But there are a few points why libraries like RapidJSON are currently much faster:
|
Beta Was this translation helpful? Give feedback.
-
Haven't tried taoJSON but is it keeping the data tree accessible like a sort of DOM? Then of course that would make modifications and additions a lot faster and parsing slower. It's been the same decades ago with XML parser, the stream parser were always faster. |
Beta Was this translation helpful? Give feedback.
-
To understand the design of taoJSON (and other libraries, including RapidJSON), you need to separate the parser from the value object. The parser will generate events (SAX-style, or "stream parser"), and from these events you generate a DOM-style object. But that is only one option, you can also directly generate a (pretty-)printed string, you can generate CBOR, UBJSON, or some foreign library's value object. Also the parsers for incoming CBOR, UBJSON, etc. generate the same events, so you can covert CBOR to pretty-printed JSON without and intermediate DOM-style object. In the nativejson-benchmark there are also SAX-style tests where you can see that only some libraries are participating, including taoJSON. |
Beta Was this translation helpful? Give feedback.
@patlecat I don't think there were significant changes, although taoJSON might get a little bit faster. But there are a few points why libraries like RapidJSON are currently much faster: