Skip to content

Commit

Permalink
chore: tweak profiles once more (foundry-rs#8317)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes authored Jul 1, 2024
1 parent 8f4a998 commit 432b23b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 21 deletions.
44 changes: 27 additions & 17 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,33 @@ all = "warn"
# NOTE: Debuggers may provide less useful information with this setting.
# Uncomment this section if you're using a debugger.
[profile.dev]
debug = 1
# https://davidlattimore.github.io/posts/2024/02/04/speeding-up-the-rust-edit-build-run-cycle.html
debug = "line-tables-only"
split-debuginfo = "unpacked"

[profile.release]
opt-level = 3
lto = "thin"
debug = "line-tables-only"
strip = "symbols"
panic = "abort"
codegen-units = 16

# Use the `--profile profiling` flag to show symbols in release mode.
# e.g. `cargo build --profile profiling`
[profile.profiling]
inherits = "release"
debug = 2
split-debuginfo = "unpacked"
strip = false

[profile.bench]
inherits = "profiling"

[profile.maxperf]
inherits = "release"
lto = "fat"
codegen-units = 1

# Speed up tests and dev build.
[profile.dev.package]
Expand Down Expand Up @@ -95,26 +121,10 @@ axum.opt-level = 3
# keystores
scrypt.opt-level = 3

[profile.release]
opt-level = 3
lto = "thin"
debug = "line-tables-only"
strip = true
panic = "abort"
codegen-units = 16

# Use the `--profile profiling` flag to show symbols in release mode.
# e.g. `cargo build --profile profiling`
[profile.profiling]
inherits = "release"
debug = 1
strip = false

# Override packages which aren't perf-sensitive for faster compilation speed.
[profile.release.package]
mdbook.opt-level = 1
protobuf.opt-level = 1
toml_edit.opt-level = 1
trezor-client.opt-level = 1

[workspace.dependencies]
Expand Down
6 changes: 2 additions & 4 deletions crates/cli/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,11 @@ impl EyreHandler for Handler {
///
/// Panics are always caught by the more debug-centric handler.
pub fn install() {
// If the user has not explicitly overridden "RUST_BACKTRACE", then produce full backtraces.
if std::env::var_os("RUST_BACKTRACE").is_none() {
std::env::set_var("RUST_BACKTRACE", "full");
std::env::set_var("RUST_BACKTRACE", "1");
}

let debug_enabled = std::env::var("FOUNDRY_DEBUG").is_ok();
if debug_enabled {
if std::env::var_os("FOUNDRY_DEBUG").is_some() {
if let Err(e) = color_eyre::install() {
debug!("failed to install color eyre error hook: {e}");
}
Expand Down

0 comments on commit 432b23b

Please sign in to comment.