Skip to content

Commit

Permalink
Move sort timer out of loop (#33448)
Browse files Browse the repository at this point in the history
move sort timer out of loop

Co-authored-by: HaoranYi <haoran.yi@solana.com>
  • Loading branch information
HaoranYi and HaoranYi authored Sep 29, 2023
1 parent e3cd13e commit 6ea5128
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions accounts-db/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7626,16 +7626,11 @@ impl AccountsDb {
}

fn sort_slot_storage_scan(accum: &mut BinnedHashData) -> u64 {
let time = AtomicU64::new(0);
accum.iter_mut().for_each(|items| {
let mut sort_time = Measure::start("sort");
let (_, sort_time) = measure_us!(accum.iter_mut().for_each(|items| {
// sort_by vs unstable because slot and write_version are already in order
items.sort_by(AccountsHasher::compare_two_hash_entries);
sort_time.stop();
time.fetch_add(sort_time.as_us(), Ordering::Relaxed);
});

time.load(Ordering::Relaxed)
}));
sort_time
}

/// normal code path returns the common cache path
Expand Down

0 comments on commit 6ea5128

Please sign in to comment.