Replies: 11 comments 11 replies
-
Correct, it is not currently possible to write (serialize) with simdjson. @jkeiser : can you take this question at your convenience? |
Beta Was this translation helpful? Give feedback.
-
A write API is an important feature for the reasons you mention, and it's on our minds--but we have some things we want to finish on the read side first (streaming and SAX particularly). So probably not soon. I expect another couple of releases to pass before we really jump into the problem. We do welcome contributions, though! If you are interested, we can always talk it out, all of us here try to be helpful :) I imagine an initial stab isn't hard if it's designed right, but it depends entirely on your experience and engagement. Probably just a "document builder" API that builds a document in the current tape format. Then people can just use the current cout << document to write it outI think it could be done without SIMD, and with a single implementation. |
Beta Was this translation helpful? Give feedback.
-
Shame it is not supported. I am very impressed with the speed of reading, but I am afraid that only having the "Read API" is not sufficient for most C++ programs |
Beta Was this translation helpful? Give feedback.
-
I would love to have also a write API for this, otherwise for my use case I'll probably just have to use something like RapidJSON |
Beta Was this translation helpful? Give feedback.
-
I'm also have same issue and thinking about something like: edit mode -> RapidJSON and read-only mode simdjson. |
Beta Was this translation helpful? Give feedback.
-
We are openly calling for interested contributors. We don’t even have design documents at this point: what we want to do and how we are going to do it efficiently. |
Beta Was this translation helpful? Give feedback.
-
Would be nice if there was some kind of central discussion thread for this but this will have to do. I would love to help but more or less fear a lack of expertise in this type of area, but for a design something like this should likely at least be on par with RapidJSON in terms of performance, although I'm not sure how SIMD could be leveraged to accelerate this process, although that's probably the least of our problems right now. It would probably also have to be separate from the core principles of the ondemand parser which is taking an iterative approach while an object builder would likely hold and have everything available immediately. |
Beta Was this translation helpful? Give feedback.
-
The following project https://github.com/getml/reflect-cpp is impressive... Their API is... enum class Color { red, green, blue, yellow };
struct Circle {
float radius;
Color color;
};
const auto circle = Circle{.radius = 2.0, .color = Color::green};
rfl::json::write(circle); It could be used for our purposes. The downside is that it requires C++20 and only supports specific compilers. It is a minor issue. |
Beta Was this translation helpful? Give feedback.
-
I'm late to the party here... I recently obtained a project at work that has me needing to create JSON programmatically from scratch - i.e. from an empty 'Document'. I found 'rapidjson' (before discovering simdjson) and it seems to do the trick well enough. It'll do just fine. But that project seems to be 'on hiatus' and I'm reluctant to use it. So I read more and come across simdjson which seems (benchmarks) to run circles around rapidjson performance-wise. So... I start my simdjson learning with having it ingest the JSON from a file that I had rapidjson create. All is fine - so far so good. Now I'm trying to take my learning to the next level by having simdjson create some JSON from scratch and..........OOPS, I'm running into a brick wall. And then I find this discussion that explains my brick wall - simdjson doesn't support creating JSON - bummer. Put me down as wishing that it did :-( |
Beta Was this translation helpful? Give feedback.
-
I should stress that simdjson is a community driven project. There is no engineering team behind it, other that the community present here. So someone needs to set out to do the work if a feature is wanted. Possibly, the best API I have seen so far is https://github.com/getml/reflect-cpp We could provide something of the sort, but it will require engineering effort. To be clear, people need to work on it. |
Beta Was this translation helpful? Give feedback.
-
I was scratching my head over the write/serialization API after started working with it
|
Beta Was this translation helpful? Give feedback.
-
Hi @lemire,
simdjson v0.3 is a beast thanks for your great work(and also for all contributors).
I have a questions on the ability to write json document(starting from an empty doc/element). As of now (v0.3) I don't see support for this. so my questions is:
the current work around is to use simdjson + another lib, so it would be nice if I could only rely on simdjson?
thanks
Beta Was this translation helpful? Give feedback.
All reactions