-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Open
Labels
A-cargo-targetsArea: selection and definition of targets (lib, bins, examples, tests, benches)Area: selection and definition of targets (lib, bins, examples, tests, benches)A-cliArea: Command-line interface, option parsing, etc.Area: Command-line interface, option parsing, etc.C-bugCategory: bugCategory: bugCommand-benchS-triageStatus: This issue is waiting on initial triage.Status: This issue is waiting on initial triage.
Description
Problem
Cargo allows you to specify a single build target for cargo run and cargo bench as in:
cargo run --bin foocargo bench --bench bar
For cargo run, only the specified target is built. However, for cargo bench, all benchmark and bin targets are built before executing the benchmark. For applications with heavyweight bins, this can slow down the build quite a bit.
Steps
- Create a project with a benchmark target
- Run
cargo bench --bench benchmark-target-name - Observe that other bins are built as well
Possible Solution(s)
No response
Notes
No response
Version
% cargo version --verbose
cargo 1.87.0 (99624be96 2025-05-06)
release: 1.87.0
commit-hash: 99624be96e9d213b0e9b1e36451271f24e4a41d8
commit-date: 2025-05-06
host: x86_64-unknown-linux-gnu
libgit2: 1.9.0 (sys:0.20.0 vendored)
libcurl: 8.12.1-DEV (sys:0.4.80+curl-8.12.1 vendored ssl:OpenSSL/3.4.1)
ssl: OpenSSL 3.4.1 11 Feb 2025
os: Amazon Linux AMI 2.0.0 [64-bit]
Metadata
Metadata
Assignees
Labels
A-cargo-targetsArea: selection and definition of targets (lib, bins, examples, tests, benches)Area: selection and definition of targets (lib, bins, examples, tests, benches)A-cliArea: Command-line interface, option parsing, etc.Area: Command-line interface, option parsing, etc.C-bugCategory: bugCategory: bugCommand-benchS-triageStatus: This issue is waiting on initial triage.Status: This issue is waiting on initial triage.
Type
Projects
Status
No status