1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 11:07:44 +00:00

Cargo.toml: Add profiling profile

Also fix comment about release profile, debug info is not there.
This commit is contained in:
Nicolas Boichat 2025-04-29 22:37:41 +08:00
parent 053e6b4d08
commit b5824cd498
2 changed files with 17 additions and 3 deletions

View file

@ -548,9 +548,9 @@ name = "uudoc"
path = "src/bin/uudoc.rs" path = "src/bin/uudoc.rs"
required-features = ["uudoc"] required-features = ["uudoc"]
# The default release profile. It contains all optimizations, without # The default release profile. It contains all optimizations.
# sacrificing debug info. With this profile (like in the standard # With this profile (like in the standard release profile),
# release profile), the debug info and the stack traces will still be available. # the stack traces will still be available.
[profile.release] [profile.release]
lto = true lto = true
@ -567,6 +567,12 @@ opt-level = "z"
panic = "abort" panic = "abort"
strip = true strip = true
# A release-like profile with debug info, useful for profiling.
# See https://github.com/mstange/samply .
[profile.profiling]
inherits = "release"
debug = true
[lints.clippy] [lints.clippy]
multiple_crate_versions = "allow" multiple_crate_versions = "allow"
cargo_common_metadata = "allow" cargo_common_metadata = "allow"

View file

@ -70,6 +70,14 @@ samply record ./target/debug/coreutils ls -R
samply record --rate 1000 ./target/debug/coreutils seq 1 1000 samply record --rate 1000 ./target/debug/coreutils seq 1 1000
``` ```
The output using the `debug` profile might be easier to understand, but the performance characteristics may be somewhat different from `release` profile that we _actually_ care about.
Consider using the `profiling` profile, that compiles in `release` mode but with debug symbols. For example:
```bash
cargo build --profile profiling -p uu_ls
samply record -r 10000 target/profiling/ls -lR /var .git .git .git > /dev/null
```
## Workflow: Measuring Performance Improvements ## Workflow: Measuring Performance Improvements
1. **Establish baselines**: 1. **Establish baselines**: