Lite³: A JSON-Compatible Zero-Copy Serialization Format in 9.3 kB of C using serialized B-tree
Posted by dmezzo@reddit | programming | View on Reddit | 5 comments
throwaway490215@reddit
Given a quick reading, I'm having trouble understanding what exactly the relationship with JSON is.
I found https://lite3.io/design_and_limitations.html#autotoc_md29 and you mention.
and
And as far as i can tell the sales pitch is that you have a function that parses JSON into a Lite3 struct which is a bunch of pointers+len to the original incoming string so you do not copy it out, and it becomes relatively cheap to forward/copyout/serialize that structure into a Lite3 continuous byte sequence that is no longer JSON but cheap to interact with?
dmezzo@reddit (OP)
No Lite³ is a standalone binary serialization format, separate from JSON. The confusion comes from the fact that Lite³ is 'JSON-Compatible', meaning that it is possible to convert between the two formats.
When using JSON standalone, you need to parse to read it, and stringify to send it over a network.
Lite³ on the other hand is a binary format, you can insert data into it directly and do not need and explicit 'stringify' or 'serializing' step. The data is already ready to send. Similarly, a received message can be interpreted directly and does not need any parsing.
I hope this answers your question.
throwaway490215@reddit
Yeah thats what I thought. There are other frameworks that let you do the borrowing, though it's a lot less common to have the btree be in a serializable format by itself.
To me it looks like yet-another-serialization format and usually they're pitched as such, with the format front and center in the readme, so that threw me for a loop.
When reading the title I was kinda hoping you were doing something really crazy to the JSON text buffer by editing/overwriting JSON
",,,{,},[,]characters to form a B-Tree without allocating at all. (Doubt thats actually possible though).CanvasFanatic@reddit
This is very cool
dmezzo@reddit (OP)
Thank you very much!