-
Notifications
You must be signed in to change notification settings - Fork 264
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
Slow to (re)compile #106
Comments
So it looks like at least in debug mode, most of the time is spent on linking when recompiling the login example after Unfortunately, this means we probably can't do much about the recompilation times of projects using the Matrix Rust SDK, outside of suggesting the use of a faster linker. There's also been many issues with the compilation times (and compiler memory usage) when working on the SDK though, I might look into that too, soon-ish. |
Thanks, that's already a great improvement just from switching linker! I'll give it a try :) Iirc my second problem was large types (had to add a type_length_limit directive at top of the sources) that I had read could be slow at the time... I'm not sure if that improved or if I still need to look into putting a key element in a Box to break the chain somewhere; I've honestly not touched at my client for a while now... |
Here's what you need for mold (lld is also be faster than the gnu linker, but not nearly as fast as mold): [target.x86_64-unknown-linux-gnu]
linker = "clang"
rustflags = [
"-C", "link-arg=-fuse-ld=mold",
] |
I'll close this issue since it isn't really actionable. We'll definitely keep an eye on compile times though, some recent improvements in that area are over at #778. |
@martinetd was surprised by the long (re)compilation times: #104 (comment).
I've played around with this locally because I assumed this comes mostly down to the large amount of generated code in Ruma, but surprisingly the ruma-client
hello_world
example recompiles in roughly 3 seconds on my machine while the matrix_sdklogin
example takes almost 6 seconds on average.Here's some things that could help that I haven't tried yet:
installing LLVMs linker, lld and using that by creating
.cargo/config.toml
withbuilding all dependencies in release mode, which may reduce the size of intermediary artifacts and thus improve relinking time, by adding the following to the
Cargo.toml
of a project using matrix_sdk (this won't work in the workspace itself because it doesn't apply to workspace crates):(for more info see the Cargo Book)
Separately from that, I've been thinking about having feature flags in Ruma such that you could choose to only have request-sending + response-receiving generated rather than getting all of request-{sending,receiving} + response-{sending,receiving}.
The text was updated successfully, but these errors were encountered: