Call for Testing: Speeding up Rust compilation with `hint-mostly-unused`
10 months ago
- #Rust
- #Nightly Features
- #Compile Time Optimization
- Introduction of nightly-only rustc option `-Zhint-mostly-unused` and corresponding Cargo features to optimize compile time by avoiding unnecessary code generation.
- Background: Current compiler generates code for entire crates, even when only a small portion is used, leading to wasted compile time.
- Performance improvements observed with `-Zhint-mostly-unused`, showing significant reductions in compile time for various large API crates.
- Cautions: The option may regress compile time if misapplied, especially for crates with mostly used APIs or multiple binaries.
- Cargo integration: New profile option `hint-mostly-unused` and `hints.mostly-unused` in `Cargo.toml` to selectively apply the hint.
- Future plans: Expansion of the `hints` mechanism in Cargo for other optimizations like `min-opt-level`.
- Call to action: Encouragement for testing and feedback on the feature, with guidelines for reporting results.
- Acknowledgements: Credit to contributors and events that facilitated the development of this feature.