shrink slots at startup uses more threads (#20251)

This commit is contained in:
Jeff Washington (jwash) 2021-09-27 14:14:55 -05:00 committed by GitHub
parent 8266864adc
commit 9d91a6f1b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -2776,10 +2776,10 @@ impl AccountsDb {
pub fn shrink_all_slots(&self, is_startup: bool, last_full_snapshot_slot: Option<Slot>) {
const DIRTY_STORES_CLEANING_THRESHOLD: usize = 10_000;
const OUTER_CHUNK_SIZE: usize = 2000;
const INNER_CHUNK_SIZE: usize = OUTER_CHUNK_SIZE / 8;
if is_startup && self.caching_enabled {
let slots = self.all_slots_in_storage();
let inner_chunk_size = std::cmp::max(INNER_CHUNK_SIZE, 1);
let threads = num_cpus::get();
let inner_chunk_size = std::cmp::max(OUTER_CHUNK_SIZE / threads, 1);
slots.chunks(OUTER_CHUNK_SIZE).for_each(|chunk| {
chunk.par_chunks(inner_chunk_size).for_each(|slots| {
for slot in slots {