Skip to content

Commit 9113d68

Browse files
authored
Use new hints.mostly-unused (#1491)
* 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). * Add comment to the mostly-unused hint
1 parent fda7cbe commit 9113d68

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ 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+
# Most users use a fraction of the rustix API surface area, so this reduces compilation times
20+
mostly-unused = true
21+
1822
[dependencies]
1923
bitflags = { version = "2.4.0", default-features = false }
2024

0 commit comments

Comments
 (0)