Skip to content

Cargo.toml: Add profiling profile #7862

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -548,9 +548,9 @@ name = "uudoc"
path = "src/bin/uudoc.rs"
required-features = ["uudoc"]

# The default release profile. It contains all optimizations, without
# sacrificing debug info. With this profile (like in the standard
# release profile), the debug info and the stack traces will still be available.
# The default release profile. It contains all optimizations.
# With this profile (like in the standard release profile),
# the stack traces will still be available.
[profile.release]
lto = true

Expand All @@ -567,6 +567,12 @@ opt-level = "z"
panic = "abort"
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]
multiple_crate_versions = "allow"
cargo_common_metadata = "allow"
Expand Down
8 changes: 8 additions & 0 deletions docs/src/performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ samply record ./target/debug/coreutils ls -R
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

1. **Establish baselines**:
Expand Down
Loading