move invariant code outside loop (#32837)

This commit is contained in:
Jeff Washington (jwash) 2023-08-17 15:28:04 -07:00 committed by GitHub
parent 13b7ae1432
commit 9260c0f645
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 9 deletions

View File

@ -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()
@ -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();