On 14/08/2023 20:25, Marc Oscar Singer via Boost-users wrote:
However, this effort is unnecessary because there is already a great library that does what you describe, and that is simdjson. Check it out:
https://github.com/simdjson/simdjson
Would this suit your needs?
Unlikely. Remember, this is for an embedded target. We are fortunate enough to have a 32 bit core. simdjson requires a 64 bit CPU.
I always preferred https://github.com/chadaustin/sajson over simdjson, because sajson is completely in-place, you feed it a buffer and no further allocations are done.
And, yes, of course ... tradeoffs. I was hopeful when I read that "Boost.JSON works great on embedded devices." For the kinds of embedded work we do, this is probably not the case. We don't tend to parse and reedit JSON. We tend to use JSON as a message serialization mechanism.
"Embedded" means a lot of things. I'd personally call it "whatever Arduino can do", but even that is pretty full featured nowadays, there is malloc and free on Arduino, std::string works as you'd expect, as does std::vector. Plenty of smaller embedded can't do any of that. I have no idea if Boost.JSON can work on Arduino, but I suspect unless it's tested by CI to at least build under Arduino, it probably does not. Last time I checked Arduino does support a particularly ancient port of Boost, somebody hand forked and patched it. So it is theoretically doable for somebody who likes masochism. Of course, just because it compiles doesn't mean you'll fit your Boost using library into a few hundred Kb of Flash or RAM, so I suggest better to stick with libraries specifically designed to work well within dozens of Kb. Niall