-
Notifications
You must be signed in to change notification settings - Fork 3
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
Cannot deserialize values due to bincode constraints #3
Comments
Hello fellow Tokyo resident. One option is to use some indirection - ie. use a Do you have a preference on an alternative format? I found this: https://github.com/djkoloski/rust_serialization_benchmark And it looks like postcard turns in respectable performance & size, and has good support. I didn't look closely enough to see if it support the metadata you need. I don't think I'll have time to look into this for a couple weeks, but if you raise a PR, I will merge it. (Just make it a Cargo feature, so people have the option of keeping compatibility with their bincode-formatted tables) BTW: do you ever go to the Tokyo Rust meetups? https://www.meetup.com/tokyo-rust-meetup/ |
Hi! Unfortunately I dont live in Tokyo at this time, had to go back due to expiring visa 😭 A friend recommended me messagepack in particular, I'll test it out and see if it works (fast enough as well). Since it's a json-like representation, it would support all the serde features like json does, too. I'll check out the rust meetups once I'm back in Japan, thanks! |
Would you prefer if I make a complete replacement of all uses of bincode for messagepack or is it enough if I just swap the de/ser parts for where the ValueT is involved? |
I don't expect it will be bad. There are a few places where I actually peek into the raw bytes, rather than doing a full deserialization. Basically everywhere I call anything in https://github.com/luketpeterson/fuzzy_rocks/blob/main/src/bincode_helpers.rs That being said, I don't remember how much of a difference it actually makes to the bottom line, so you might just run the deserializer for simplicity. When I wrote this 2 years ago my use case was incredibly performance-sensitive, but if you just need something reasonable then I don't think it's totally necessary to go to these lengths.
That sounds like a reasonable choice to me if you think it satisfies the other needs. According to the benchmarks, both msgpacker and rmp-serde are within a factor of 1.5 of Bincode, and a factor of 2 (except at serialization) of the best formats in the benchmark. And the format seems to be well supported and documented. As to which MessagePack crate to use, the benchmarks say the performance is in the same league, with
My feeling is that it probably makes sense to use one format or the other. Like you said keeping the dependencies minimal. But it's not a strong opinion on my part, just a feeling. Thanks. |
Looking a little closer, a lot of people just use the rmp crate directly, without depending on serde at all. So perhaps this is the best-supported option with 12M+ downloads. |
@jannisbecker With https://crates.io/crates/fuzzy_rocks/0.3.0 I added the ability to provide a custom coder object, and I implemented a coder for MessagePack. In practice, BinCode is still 80% faster and the compressed database is only 10% bigger, so I left it as the default, but you can use the Let me know if this works or if you have any other ideas to improve it. |
Hi there.
According to bincode-org/bincode#548 and https://docs.rs/bincode/2.0.0-rc.3/bincode/serde/index.html#known-issues, bincode doesn't support several of serde's derive macros, some of them have pretty common use. Unfortunately, this makes me unable to use fuzzy_rocks with my data.
Is there a way to use a different serde data format that does support serde metadata (and hence all of serde's functionality?)
The text was updated successfully, but these errors were encountered: