Skip to content
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

chore: tweak profiles, rename debug-fast to profiling #9051

Merged
merged 1 commit into from
Jun 24, 2024
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
16 changes: 10 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -224,20 +224,24 @@ opt-level = 3
lto = "thin"

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

# Like release, but with full debug symbols. Useful for e.g. `perf`.
[profile.debug-fast]
# Use the `--profile profiling` flag to show symbols in release mode.
# e.g. `cargo build --profile profiling`
[profile.profiling]
inherits = "release"
strip = "none"
debug = true
debug = 1
strip = false

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

[workspace.dependencies]
# reth
Expand Down
3 changes: 1 addition & 2 deletions bin/reth-bench/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ As long as the data is representative of real-world load, or closer to worst-cas

## Prerequisites

If you will be collecting CPU profiles, make sure `reth` is compiled with the `debug-fast` profile.
For collecting memory profiles, make sure `reth` is also compiled with the `--features profiling` flag.
If you will be collecting CPU profiles, make sure `reth` is compiled with the `profiling` profile.
Otherwise, running `make maxperf` at the root of the repo should be sufficient for collecting accurate performance metrics.

## Command Usage
Expand Down
6 changes: 3 additions & 3 deletions book/developers/profiling.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ cargo build --features jemalloc-prof
```

When performing a longer-running or performance-sensitive task with reth, such as a sync test or load benchmark, it's usually recommended to use the `maxperf` profile. However, the `maxperf`
profile does not enable debug symbols, which are required for tools like `perf` and `jemalloc` to produce results that a human can interpret. Reth includes a performance profile with debug symbols called `debug-fast`. To compile reth with debug symbols, jemalloc, profiling, and a performance profile:
profile does not enable debug symbols, which are required for tools like `perf` and `jemalloc` to produce results that a human can interpret. Reth includes a performance profile with debug symbols called `profiling`. To compile reth with debug symbols, jemalloc, profiling, and a performance profile:
```
cargo build --features jemalloc-prof --profile debug-fast
cargo build --features jemalloc-prof --profile profiling

# May improve performance even more
RUSTFLAGS="-C target-cpu=native" cargo build --features jemalloc-prof --profile debug-fast
RUSTFLAGS="-C target-cpu=native" cargo build --features jemalloc-prof --profile profiling
```

### Monitoring memory usage
Expand Down
2 changes: 1 addition & 1 deletion crates/consensus/beacon/src/engine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2162,7 +2162,7 @@ mod tests {
b.clone().try_seal_with_senders().expect("invalid tx signature in block"),
None,
)
.map(|_| ())
.map(drop)
})
.expect("failed to insert");
provider.commit().unwrap();
Expand Down
2 changes: 1 addition & 1 deletion crates/net/discv4/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1537,7 +1537,7 @@ impl Discv4Service {
/// - timestamp is expired (lower than current local UNIX timestamp)
fn ensure_not_expired(&self, timestamp: u64) -> Result<(), ()> {
// ensure the timestamp is a valid UNIX timestamp
let _ = i64::try_from(timestamp).map_err(|_| ())?;
let _ = i64::try_from(timestamp).map_err(drop)?;

let now = SystemTime::now().duration_since(UNIX_EPOCH).unwrap_or_default().as_secs();
if self.config.enforce_expiration_timestamps && timestamp < now {
Expand Down
2 changes: 1 addition & 1 deletion crates/primitives/src/alloy_compat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ impl TryFrom<alloy_rpc_types::Transaction> for Transaction {
.gas
.try_into()
.map_err(|_| ConversionError::Eip2718Error(RlpError::Overflow.into()))?,
placeholder: tx.to.map(|_| ()),
placeholder: tx.to.map(drop),
to: tx.to.unwrap_or_default(),
value: tx.value,
access_list: tx.access_list.ok_or(ConversionError::MissingAccessList)?,
Expand Down
2 changes: 1 addition & 1 deletion crates/stages/stages/src/stages/bodies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ mod tests {
let transaction = random_signed_tx(&mut rng);
static_file_producer
.append_transaction(tx_num, transaction.into())
.map(|_| ())
.map(drop)
})?;

if body.tx_count != 0 {
Expand Down
4 changes: 2 additions & 2 deletions crates/tasks/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ impl TaskExecutor {
error!("{task_error}");
let _ = panicked_tasks_tx.send(task_error);
})
.map(|_| ())
.map(drop)
.in_current_span();

self.handle.spawn(task)
Expand Down Expand Up @@ -513,7 +513,7 @@ impl TaskExecutor {
error!("{task_error}");
let _ = panicked_tasks_tx.send(task_error);
})
.map(|_| ())
.map(drop)
.in_current_span();

self.handle.spawn(task)
Expand Down
Loading