eliminate unnecessary copies in accounts index generation (#18466)
This commit is contained in:
parent
49c4e54b28
commit
eca0ceb04c
|
@ -5982,21 +5982,22 @@ impl AccountsDb {
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut stored_sizes_and_counts = HashMap::new();
|
let mut stored_sizes_and_counts = HashMap::new();
|
||||||
for account_entry in self
|
self.accounts_index.account_maps.iter().for_each(|i| {
|
||||||
.accounts_index
|
i.read().unwrap().values().for_each(|entry| {
|
||||||
.account_maps
|
entry
|
||||||
.iter()
|
.slot_list
|
||||||
.map(|i| i.read().unwrap().values().cloned().collect::<Vec<_>>())
|
.read()
|
||||||
.flatten()
|
.unwrap()
|
||||||
{
|
.iter()
|
||||||
for (_slot, account_entry) in account_entry.slot_list.read().unwrap().iter() {
|
.for_each(|(_slot, account_entry)| {
|
||||||
let storage_entry_meta = stored_sizes_and_counts
|
let storage_entry_meta = stored_sizes_and_counts
|
||||||
.entry(account_entry.store_id)
|
.entry(account_entry.store_id)
|
||||||
.or_insert((0, 0));
|
.or_insert((0, 0));
|
||||||
storage_entry_meta.0 += account_entry.stored_size;
|
storage_entry_meta.0 += account_entry.stored_size;
|
||||||
storage_entry_meta.1 += 1;
|
storage_entry_meta.1 += 1;
|
||||||
}
|
})
|
||||||
}
|
})
|
||||||
|
});
|
||||||
for slot_stores in self.storage.0.iter() {
|
for slot_stores in self.storage.0.iter() {
|
||||||
for (id, store) in slot_stores.value().read().unwrap().iter() {
|
for (id, store) in slot_stores.value().read().unwrap().iter() {
|
||||||
// Should be default at this point
|
// Should be default at this point
|
||||||
|
|
Loading…
Reference in New Issue