Skip to content

Commit

Permalink
Rebase. Use Vec::with_capacity to create vec with proper initial size.
Browse files Browse the repository at this point in the history
  • Loading branch information
yhchiang-sol committed Feb 2, 2024
1 parent 6d1f78f commit 5db980e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions accounts-db/src/tiered_storage/hot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,10 +465,14 @@ impl HotStorageReader {
&self,
mut index_offset: IndexOffset,
) -> TieredStorageResult<Vec<StoredAccountMeta>> {
let mut accounts = vec![];
let mut accounts = Vec::with_capacity(
self.footer
.account_entry_count
.saturating_sub(index_offset.0) as usize,
);
while let Some((account, next)) = self.get_account(index_offset)? {
accounts.push(account);
index_offset = IndexOffset(next as u32);
index_offset = next;
}
Ok(accounts)
}
Expand Down

0 comments on commit 5db980e

Please sign in to comment.