You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 15, 2021. It is now read-only.
The example file below contains a load of serde-derive'd structs and code to load them using serde_cbor. I compiled it in release & debug, and then again after changing serde_cbor to serde_json to get the following compile times:
Debug
Release
serde_json
5.0s
13.3s
serde_cbor
11.2s
53.9s
As you can see it is a lot slower than serde_json, and the release build is unusably slow. By looking at the Rust and LLVM profiling outputs I found that most of the time is spent in LLVM and mostly in optimising serde_cbor-related functions.
I compared the output of cargo expand and as expected the only line that changes is serde_cbor/json::from_reader().
And then open the resulting llvm_timings.json in about:tracing.
If you zoom in and click on the OptFunction blocks it tells you which function it is optimising.
From clicking around randomly the most common one is serde_cbor::de::Deserializer<R>::parse_value function (with various hashes at the end), but there's also parse_str, parse_map, recursion_checked, etc. Kind of makes sense because parse_value has that big map but honesty I can't see why it should take so long.
I'm just commenting on this issue to say that I've seen the same problem: serde_cbor consumes 60-70% of my code's build time. I can't blame the author, he is busy and according to this post never meant to maintain this project at serious level. I have switched to ciborium, which is newer and perhaps more risky, but has normal compilation times.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The example file below contains a load of serde-derive'd structs and code to load them using serde_cbor. I compiled it in release & debug, and then again after changing
serde_cbor
toserde_json
to get the following compile times:As you can see it is a lot slower than
serde_json
, and the release build is unusably slow. By looking at the Rust and LLVM profiling outputs I found that most of the time is spent in LLVM and mostly in optimising serde_cbor-related functions.I compared the output of
cargo expand
and as expected the only line that changes isserde_cbor/json::from_reader()
.To get the LLVM timings run this command:
And then open the resulting
llvm_timings.json
inabout:tracing
.If you zoom in and click on the
OptFunction
blocks it tells you which function it is optimising.From clicking around randomly the most common one is
serde_cbor::de::Deserializer<R>::parse_value
function (with various hashes at the end), but there's alsoparse_str
,parse_map
,recursion_checked
, etc. Kind of makes sense becauseparse_value
has that big map but honesty I can't see why it should take so long.Here's my test code:
The text was updated successfully, but these errors were encountered: