Support a crate flag to recommend optimization
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 15.5k
- Forks
- 3k
- Avg merge
- 23h 30m
- Merged PRs (30d)
- 51
Description
As a further enhancement to https://github.com/rust-lang/cargo/pull/8500 , we'd like to have an option in Cargo.toml for a library crate to specify that it should almost always be optimized unless specifically requested otherwise.
This would be for crates like phf or lalrpop or munkres, where the optimization level makes a massive performance difference.
We could pay attention to this option whenever we're building with a "default" opt-level of 0, such as for build-dependencies with https://github.com/rust-lang/cargo/pull/8500 , or for dev/test builds. If a crate explicitly says that the dependency should use opt-level 0, we would do that, but if we're only using opt-level 0 because of a built-in default, then a dependency's Cargo.toml specifying to optimize it would be respected.
I'd suggest an option like default-optimized = true.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the behavior proposed in PR #8500 and the Cargo.toml configuration described here, then trace how default opt-level 0 is applied to build, dev, and test dependencies. Done means a documented crate-level optimization recommendation that respects explicit opt-level 0 requests while overriding only built-in defaults, with coverage for the stated cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system, performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100