bench: add a profiling profile that doesn't enable LTO for quick rebuilds

This commit is contained in:
Benjamin Bouvier
2025-02-13 17:02:58 +01:00
committed by Ivan Enderlin
parent 0b7140c123
commit 9f47201bab
2 changed files with 17 additions and 3 deletions
+7
View File
@@ -143,6 +143,13 @@ debug = 2
inherits = "dbg"
opt-level = 3
[profile.profiling]
inherits = "release"
# LTO is too slow to compile.
lto = false
# Get symbol names for profiling purposes.
debug = true
[patch.crates-io]
async-compat = { git = "https://github.com/jplatte/async-compat", rev = "16dc8597ec09a6102d58d4e7b67714a35dd0ecb8" }
const_panic = { git = "https://github.com/jplatte/const_panic", rev = "9024a4cb3eac45c1d2d980f17aaee287b17be498" }
+10 -3
View File
@@ -8,7 +8,7 @@ can be found [here](https://bheisler.github.io/criterion.rs/book/criterion_rs.ht
## Running the benchmarks
The benchmark can be simply run by using the `bench` command of `cargo`:
The benchmark can be run by using the `bench` command of `cargo`:
```bash
$ cargo bench
@@ -16,6 +16,13 @@ $ cargo bench
This will work from the workspace directory of the rust-sdk.
To lower compile times, you might be interested in using the `profiling` profile, that's optimized
for a fair tradeoff between compile times and runtime performance:
```bash
$ cargo bench --profile profiling
```
If you want to pass options to the benchmark [you'll need to specify the name of
the benchmark](https://bheisler.github.io/criterion.rs/book/faq.html#cargo-bench-gives-unrecognized-option-errors-for-valid-command-line-options):
@@ -23,7 +30,7 @@ the benchmark](https://bheisler.github.io/criterion.rs/book/faq.html#cargo-bench
$ cargo bench --bench crypto_bench -- # Your options go here
```
If you want to run only a specific benchmark, simply pass the name of the
If you want to run only a specific benchmark, pass the name of the
benchmark as an argument:
```bash
@@ -65,7 +72,7 @@ permisive value is `-1`:
$ echo -1 | sudo tee /proc/sys/kernel/perf_event_paranoid
```
To generate flame graphs feature simply enable the profiling mode using the
To generate flame graphs feature, enable the profiling mode using the
`--profile-time` command line flag:
```bash