New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate to CBOR as the de facto serialization format #253
Comments
There's also CBOR which is inspired by MessagePack but is also standardized at IETF and has a few features that MessagePack doesn't support, like differentiating between text strings and binary strings afaik. |
Yeah, differentiating text and binary strings does sound like it'd come in handy, especially for scripting compatibility. I'll take a look at CBOR. I've used Flatbuffers and looked at rkyv before but they don't fit our criteria for being schemaless. Both of these will definitely come in handy if we ever need very application-specific encoding formats where minimizing bandwidth is of utmost performance. Thank you for your contribution! It's always good to see new faces. :) |
What made you decide on CBOR over MessagePack so quickly? Apparently the text string/binary string issue is misinformation on my part according to this article: https://diziet.dreamwidth.org/2020/07/14/
|
To answer your question both ways... The reason why I decided on CBOR over MessagePack is:
The reason why I decided so quickly was because indecision can really paralyze these kinds of big sweeping design decisions, and even if there's some big mistake and we have to make all the same changes to the repository again with MessagePack instead or some other protocol, that's better than never attempting to migrate at all, or spending a lot of developer time studying and angsting over small differences between protocols. Since Hearth is such a small project right now, we have the benefit of really high agility in these kinds of decisions, so we should be taking advantage of that. |
That sounds pretty inspiring. I kind of resonate with paralization in regards to studying different standards and solutions. I often spend a lot of time investigating before I work on my projects and I'm a pretty slow developer, perhaps because of that :/
|
Could also ditch serde entirely and use this to reduce wasm binary sizes: https://docs.rs/minicbor/latest/minicbor/ |
When #278 closes I would like to try to dab into this, sounds fun and interesting |
That would be fantastic, thank you so much! I figure that we should save potentially using |
We've been using JSON, which bloats message size, is inefficient to encode and decode floats and integers, and requires conversion of blobs to base64 strings in order to have reasonable fast serialization. This kinda sucks!
A new message format that alleviates these problems should have the following properties:
CBOR satisfies all of these goals. No more base64! No more processes bottlenecked by ser/de!
To-do:
send
/recv
serialized by default and addsend_raw
/recv_raw
for bare messages #278serde_with
from schema and DON'T base64-encode anythingciborium
to runtime and use it to serialize events inPubSub
, deserialize messages inSinkProcess
, and serialize responses inRequestResponseProcess
.serde_json
forciborium
in initserde_json
forciborium
inrun_wasm
exampleserde_json
dep from workspace, schema, ctl, init, wasm, server, fs, and runtime.serde_json
forciborium
in guestciborium
to kindling workspace depsserde_json
tociborium
ciborium
from kindlingThen, after #197:
ByteVec
with customDeserialize
andSerialize
implementations that read and write the serde bytes data type directlyJsonAssetLoader
intoCborAssetLoader
The text was updated successfully, but these errors were encountered: