Skip to content

Commit 9b49d97

Browse files
committed
Use new hints.mostly-unused
Most users of the `rustix` crate will use a fraction of its API surface area. Nightly rustc provides an option `-Zhint-mostly-unused` to tell it to defer as much compilation as possible, which provides a substantial performance improvement if most of that compilation doesn't end up happening. Cargo plumbs this option through using the new `[hints]` table. This will cause users of the `rustix` crate to default to setting `hint-mostly-unused`. (Top-level crates can override this if they wish, using a new profile option.) Note that setting this hint does not increase the MSRV of the rustix crate, as old versions of Cargo will ignore it. New versions of Cargo will respect it automatically (and, until we stabilize it, Cargo will do nothing unless you pass `-Zprofile-hint-mostly-unused` to cargo). Some sample performance numbers: this takes `rustix` compilation time with `all-apis` enabled from 5.9s to 4.3s (a 27% improvement).
1 parent fda7cbe commit 9b49d97

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ categories = ["os::unix-apis", "date-and-time", "filesystem", "network-programmi
1515
include = ["src", "build.rs", "Cargo.toml", "COPYRIGHT", "LICENSE*", "/*.md", "benches"]
1616
rust-version = "1.63"
1717

18+
[hints]
19+
mostly-unused = true
20+
1821
[dependencies]
1922
bitflags = { version = "2.4.0", default-features = false }
2023

0 commit comments

Comments
 (0)