Trying a faster linker for Rust
Hi all, When working with a compiled language (like Rust, in this case), you must often rebuild the project to test your changes. On my system, after a small change, rebuilding Agama takes around 4 seconds[1]. TIL that most of the time is spent by the linker, and you can switch to a faster one if you wish. In my case, the build time was reduced to around 1.6 seconds. AFAIK, you have two options: lld[2] and mold[3], and both of them are available in openSUSE Tumbleweed. You need to install "clang" and "lld" or "mold" packages. Then, add the following lines to your ~/.cargo/config.toml file: [target.x86_64-unknown-linux-gnu] rustflags = ["-C", "linker=clang", "-C", "link-arg=-fuse-ld=lld"] Replace "lld" with "mold" if you prefer. And that's all 🙂 PS: you can want to know how much time it takes to compile each crate, try "cargo build --timings" and check the generated report. Regards, Imo [1] Bear in mind that a complete rebuild takes around 35-40 seconds if the dependencies are already downloaded, but that's a different history. [2] https://lld.llvm.org/ [3] https://github.com/rui314/mold
On 4/27/23 07:59, Imobach Gonzalez Sosa wrote:
Hi all,
[...]
[1] Bear in mind that a complete rebuild takes around 35-40 seconds if the dependencies are already downloaded, but that's a different history.
https://xkcd.com/303/ -- Ancor González Sosa YaST Team at SUSE Software Solutions
participants (2)
-
Ancor Gonzalez Sosa
-
Imobach Gonzalez Sosa