-
Notifications
You must be signed in to change notification settings - Fork 10
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
Linking Time #50
Comments
Personally, I use two workarounds for this:
This is the # This speeds up small changes dramatically.
# With lld enabled, doing a small change and then
# recompiling takes 0,789s in total on a project of mine.
# Without lld, the same change takes 1,842s.
[target.x86_64-unknown-linux-gnu]
linker = "/usr/bin/clang"
rustflags = ["-Clink-arg=-fuse-ld=lld"] Disabling debuginfo on a per-project basis is easy as well: example commit. |
I have experienced the long linking times too and also ended up using LLD. To install LLD I just renamed it to I hadn't heard about the debuginfo stuff. That is a really useful tip! 😃 Compile times ( more specifically re-compiling times ) are the single largest problem that I have with using Rust in general so any tips and tricks to speed that up during development would be great to have consolidated somewhere. |
I am working on hot reloading of compartmentalised shared libraries. At the moment shared libraries are still generated per crate, but it might even be doable to split this up on module-basis in the future. Apart from improving developer efficiency, it also has the potential of reducing compile times. This approach is similar to the one described by Embark Studios (EmbarkStudios/rust-ecosystem#13) For the current state of the project, have a look at this Reddit thread. In the near future, I will upload the latest version of the source code here. |
For development I’ve always considered doing it, but for release, because of Rust lacking a proper ABI, it might never work. 😢 |
Note: I've updated the top post of this issue with a note on how to configure |
This can really really help for Android builds as well. On professional C++ codebases I've previously cut link times from >1 minute to ~10 seconds - per project (many) x arch (4 - x86, x64, arm, arm64) x build (many) combination - by just using For the |
Hey all, not much for advice but for the Veloren project we're doing some unique stuff:
I think there is a reason we're using gold over lld, but I'm not too sure. We were going to switch from vanilla to lld, but gold was the one we chose. I don't have any numbers on our CI improvements, as our runners are each custom and unique. Also, here is our dev profile:
|
Update: Seems to play badly with |
Looks like ld64.lld linker cannot link stdlib on target.x86_64-pc-windows-gnu |
There was a reddit thread I just saw in the rust_gamedev group, and many people were reporting specifically that link times were killing the development flow.
I figured it needed a tracker/complaint issue here.
UPDATE:
@MaulingMonkey advised that
lld-link.exe
is already a working drop-in replacement on windows that will generally Just Work(tm) with the MSVC toolchain. It's not default but you can configure it to be used while we wait for the default compiler selection to catch up.You can pass a compiler arg to use the linker:
Or you can set a config setting in your cargo config file
(eg:
C:\Users\<username>\.cargo\config
):It's a little less of a sure thing with the MingW toolchain, but you shouldn't be using that toolchain anyway, so whatever. This should probably work though:
Of course you'll need to install LLVM for this to work: http://releases.llvm.org/download.html
Naturally you already had LLVM on your dev machine because you need it for
bindgen
, right? ;3and of course, edit the paths above to whatever folder you install LLVM to if you use a non-default directory.
Note: As with any other
.cargo/config
setting, you can also apply this on a per project basis by placing a config file into[project_folder]/.cargo/config
, however I don't personally advise this because it makes the project less portable. While the target triple will change from machine to machine, if another windows dev without the LLVM linker tries to build it on their machine they'll suddenly get a build error.Note: Using
lld-link.exe
seems to not work withmiri
,The text was updated successfully, but these errors were encountered: