-
For an example when parsing json string to something like binary json, it's really better than ondemand. And I consider other usecases exists, althouth for most usecases dom/ondemand better alternative. Some example: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment · 7 replies
-
it's really better than ondemand. We designed On-Demand specifically as a replacement for event-based parsing. We had, for a time, an event-based API but we removed it. It is not faster and I feel that for most people, it is harder to use. If you find On-Demand difficult to use for some use cases, please raise specific issues, we will try to address it. |
Beta Was this translation helpful? Give feedback.
@MBkkt
This code looks very good to me: https://github.com/ydb-platform/ydb/blob/74df9273b222dc253487508e6f4602237f4a7c11/ydb/library/binary_json/write.cpp#L553
❤️
We get pretty decent results with recursion and the code is relatively elegant. The one annoying caveat is that GCC and LLVM differ in how they handle recursion in practice, so a bit of care is needed if one wants to get good performance. But that's relatively minor.
Please see...
https://github.com/simdjson/simdjson/blob/master/benchmark/json2msgpack/simdjson_ondemand.h
Depending on your compiler, you might get better result when passing by value instead of by reference.