diff --git a/accounts-db/src/tiered_storage/hot.rs b/accounts-db/src/tiered_storage/hot.rs index ca30a796f3bb9e..54091313cb9de7 100644 --- a/accounts-db/src/tiered_storage/hot.rs +++ b/accounts-db/src/tiered_storage/hot.rs @@ -465,10 +465,14 @@ impl HotStorageReader { &self, mut index_offset: IndexOffset, ) -> TieredStorageResult> { - 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) }