@@ -86,24 +86,6 @@ Trade-offs:
8686- ✅ Faster build times (both ` cargo check ` and ` cargo build ` )
8787- ❌ ** Requires using nightly Rust and an [ unstable Rust feature] [ parallel-frontend-issue ] **
8888
89- ## Reducing built code
90-
91- ### Removing unused dependencies
92-
93- Recommendation: Periodically review unused dependencies for removal using third-party tools like
94- [ cargo-machete] ( https://crates.io/crates/cargo-machete ) ,
95- [ cargo-udeps] ( https://crates.io/crates/cargo-udeps ) ,
96- [ cargo-shear] ( https://crates.io/crates/cargo-shear ) .
97-
98- When changing code,
99- it can be easy to miss that a dependency is no longer used and can be removed.
100-
101- > * Note:* native support for this in Cargo is being tracked in [ #15813 ] ( https://github.com/rust-lang/cargo/issues/15813 ) .
102-
103- Trade-offs:
104- - ✅ Faster full build and link times
105- - ❌ May incorrectly flag dependencies as unused or miss some
106-
10789[ parallel-frontend-blog ] : https://blog.rust-lang.org/2023/11/09/parallel-rustc/
10890[ parallel-frontend-issue ] : https://github.com/rust-lang/rust/issues/113349
10991[ build.rustflags ] : ../reference/config.md#buildrustflags
@@ -130,8 +112,34 @@ linker = "clang"
130112rustflags = [" -C" , " link-arg=-fuse-ld=/path/to/mold" ]
131113```
132114
133- > Note that since Rust ` 1.90.0 ` , the ` x86_64-unknown-linux-gnu ` target already defaults to the LLD linker.
134-
135115Trade-offs:
136116- ✅ Faster link times
137117- ❌ Might not support all use-cases, in particular if you depend on C or C++ dependencies
118+
119+ The performance improvement depends a lot on your operating system:
120+ - On Linux, the system linker tends to be quite slow, and an alternative linker can provide a massive improvement in linking performance.
121+ - Note that since Rust ` 1.90.0 ` , the ` x86_64-unknown-linux-gnu ` Linux target already defaults to the LLD linker.
122+ - On Windows, an alternative linker can somewhat help linking performance.
123+ - On macOS, the system linker is already very fast, and thus an alternative linker won't help much.
124+
125+ Using an alternative linker by default is being tracked in the following issues:
126+ - [ Using LLD by default on Windows] ( https://github.com/rust-lang/rust/issues/71520 )
127+ - [ Using LLD by default everywhere] ( https://github.com/rust-lang/rust/issues/39915 )
128+
129+ ## Reducing built code
130+
131+ ### Removing unused dependencies
132+
133+ Recommendation: Periodically review unused dependencies for removal using third-party tools like
134+ [ cargo-machete] ( https://crates.io/crates/cargo-machete ) ,
135+ [ cargo-udeps] ( https://crates.io/crates/cargo-udeps ) ,
136+ [ cargo-shear] ( https://crates.io/crates/cargo-shear ) .
137+
138+ When changing code,
139+ it can be easy to miss that a dependency is no longer used and can be removed.
140+
141+ > * Note:* native support for this in Cargo is being tracked in [ #15813 ] ( https://github.com/rust-lang/cargo/issues/15813 ) .
142+
143+ Trade-offs:
144+ - ✅ Faster full build and link times
145+ - ❌ May incorrectly flag dependencies as unused or miss some
0 commit comments