Skip to content

Commit

Permalink
iterate once
Browse files Browse the repository at this point in the history
  • Loading branch information
shekhirin committed Jan 30, 2025
1 parent e17058e commit 4afe2cb
Showing 1 changed file with 15 additions and 27 deletions.
42 changes: 15 additions & 27 deletions crates/engine/tree/src/tree/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -689,36 +689,24 @@ where
self.metrics
.proof_calculation_duration_histogram
.record(proof_calculated.elapsed);
let with_account_accounts = proof_calculated
.update
.targets
.values()
.filter(|slots| slots.is_with_account())
.count();
let with_account_slots = proof_calculated
.update
.targets
.values()
.filter(|slots| slots.is_with_account())
.map(|slots| slots.len())
.sum::<usize>();

let mut with_account_accounts = 0;
let mut with_account_slots = 0;
let mut only_storage_accounts = 0;
let mut only_storage_slots = 0;
for slots in proof_calculated.update.targets.values() {
if slots.is_with_account() {
with_account_accounts += 1;
with_account_slots += slots.len();
} else if slots.is_only_storage() {
only_storage_accounts += 1;
only_storage_slots += slots.len();
}
}

self.metrics
.proof_calculation_with_account_targets_histogram
.record(with_account_accounts as f64);

let only_storage_accounts = proof_calculated
.update
.targets
.values()
.filter(|slots| slots.is_only_storage())
.count();
let only_storage_slots = proof_calculated
.update
.targets
.values()
.filter(|slots| slots.is_only_storage())
.map(|slots| slots.len())
.sum::<usize>();
self.metrics
.proof_calculation_only_storage_targets_histogram
.record(only_storage_accounts as f64);
Expand Down

0 comments on commit 4afe2cb

Please sign in to comment.