2023-10-02 14:03:19 +01:00
|
|
|
|
# cargo bench
|
|
|
|
|
|
|
|
|
|
> Compile and execute benchmarks.
|
|
|
|
|
> More information: <https://doc.rust-lang.org/cargo/commands/cargo-bench.html>.
|
|
|
|
|
|
|
|
|
|
- Execute all benchmarks of a package:
|
|
|
|
|
|
|
|
|
|
`cargo bench`
|
|
|
|
|
|
2023-10-29 08:54:53 +00:00
|
|
|
|
- Don't stop when a benchmark fails:
|
2023-10-02 14:03:19 +01:00
|
|
|
|
|
2023-10-29 08:54:53 +00:00
|
|
|
|
`cargo bench --no-fail-fast`
|
2023-10-02 14:03:19 +01:00
|
|
|
|
|
2023-10-29 08:54:53 +00:00
|
|
|
|
- Compile, but don’t run benchmarks:
|
2023-10-02 14:03:19 +01:00
|
|
|
|
|
2023-10-29 08:54:53 +00:00
|
|
|
|
`cargo bench --no-run`
|
2023-10-02 14:03:19 +01:00
|
|
|
|
|
|
|
|
|
- Benchmark the specified benchmark:
|
|
|
|
|
|
|
|
|
|
`cargo bench --bench {{benchmark}}`
|
|
|
|
|
|
|
|
|
|
- Benchmark with the given profile (default: `bench`):
|
|
|
|
|
|
|
|
|
|
`cargo bench --profile {{profile}}`
|
|
|
|
|
|
|
|
|
|
- Benchmark all example targets:
|
|
|
|
|
|
|
|
|
|
`cargo bench --examples`
|
|
|
|
|
|
|
|
|
|
- Benchmark all binary targets:
|
|
|
|
|
|
|
|
|
|
`cargo bench --bins`
|
|
|
|
|
|
|
|
|
|
- Benchmark the package’s library:
|
|
|
|
|
|
|
|
|
|
`cargo bench --lib`
|