Skip to content

Commit

Permalink
move invariant code outside loop (#32837)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffwashington authored Aug 17, 2023
1 parent 13b7ae1 commit 9260c0f
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions accounts-db/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7205,6 +7205,15 @@ impl AccountsDb {
);
let splitter = SplitAncientStorages::new(oldest_non_ancient_slot, snapshot_storages);

let slots_per_epoch = config
.rent_collector
.epoch_schedule
.get_slots_in_epoch(config.rent_collector.epoch);
let one_epoch_old = snapshot_storages
.range()
.end
.saturating_sub(slots_per_epoch);

stats.scan_chunks = splitter.chunk_count;
(0..splitter.chunk_count)
.into_par_iter()
Expand All @@ -7213,15 +7222,6 @@ impl AccountsDb {

let range_this_chunk = splitter.get_slot_range(chunk)?;

let slots_per_epoch = config
.rent_collector
.epoch_schedule
.get_slots_in_epoch(config.rent_collector.epoch);
let one_epoch_old = snapshot_storages
.range()
.end
.saturating_sub(slots_per_epoch);

let file_name = {
let mut load_from_cache = true;
let mut hasher = hash_map::DefaultHasher::new();
Expand Down

0 comments on commit 9260c0f

Please sign in to comment.