Skip to content

Commit afc1e77

Browse files
committed
windows: Use new hints.mostly-unused
Most users of the `windows` 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 `windows` 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 Windows 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 `windows` compilation time with all Graphics and UI features enabled from 18.3s to 10.7s (a 42% improvement), and takes compilation time with *all* features enabled from 3m48s to 2m55s (a 23% improvement).
1 parent 99208c8 commit afc1e77

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

crates/libs/windows/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ readme = "readme.md"
1313
categories = ["os::windows-apis"]
1414
exclude = ["features.json"]
1515

16+
[hints]
17+
mostly-unused = true
18+
1619
[dependencies]
1720
windows-collections = { workspace = true }
1821
windows-core = { workspace = true }

0 commit comments

Comments
 (0)