Skip to content

Commit

Permalink
filter get_snapshot_storages for requested_slots earlier (solana-labs…
Browse files Browse the repository at this point in the history
…#29465)

* filter get_snapshot_storages for requested_slots earlier

* Update runtime/src/accounts_db.rs

Co-authored-by: apfitzge <[email protected]>

Co-authored-by: apfitzge <[email protected]>
  • Loading branch information
2 people authored and nickfrosty committed Jan 4, 2023
1 parent c1bacd0 commit b89b498
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions runtime/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8533,6 +8533,7 @@ impl AccountsDb {
.storage
.iter()
.map(|k| *k.key() as Slot)
.filter(|slot| requested_slots.contains(slot))
.collect::<Vec<_>>();
m.stop();
let mut m2 = Measure::start("filter");
Expand All @@ -8545,11 +8546,10 @@ impl AccountsDb {
slots
.iter()
.filter_map(|slot| {
if requested_slots.contains(slot)
&& (self.accounts_index.is_alive_root(*slot)
|| ancestors
.map(|ancestors| ancestors.contains_key(slot))
.unwrap_or_default())
if self.accounts_index.is_alive_root(*slot)
|| ancestors
.map(|ancestors| ancestors.contains_key(slot))
.unwrap_or_default()
{
self.storage.get(slot).map_or_else(
|| None,
Expand Down

0 comments on commit b89b498

Please sign in to comment.