replace Ancestors HashMap for performance (#16477)

* replace Ancestors HashMap for performance

* add ancestors module
This commit is contained in:
Jeff Washington (jwash)
2021-05-20 10:11:56 -05:00
committed by GitHub
parent ddfc15b9f2
commit a9aa533684
7 changed files with 372 additions and 26 deletions

View File

@ -108,7 +108,7 @@ fn test_accounts_hash_bank_hash(bencher: &mut Bencher) {
let num_accounts = 60_000;
let slot = 0;
create_test_accounts(&accounts, &mut pubkeys, num_accounts, slot);
let ancestors = vec![(0, 0)].into_iter().collect();
let ancestors = Ancestors::from(vec![(0, 0)]);
let (_, total_lamports) = accounts.accounts_db.update_accounts_hash(0, &ancestors);
bencher.iter(|| assert!(accounts.verify_bank_hash_and_lamports(0, &ancestors, total_lamports)));
}
@ -124,7 +124,7 @@ fn test_update_accounts_hash(bencher: &mut Bencher) {
);
let mut pubkeys: Vec<Pubkey> = vec![];
create_test_accounts(&accounts, &mut pubkeys, 50_000, 0);
let ancestors = vec![(0, 0)].into_iter().collect();
let ancestors = Ancestors::from(vec![(0, 0)]);
bencher.iter(|| {
accounts.accounts_db.update_accounts_hash(0, &ancestors);
});
@ -378,7 +378,7 @@ fn bench_load_largest_accounts(b: &mut Bencher) {
let account = AccountSharedData::new(lamports, 0, &Pubkey::default());
accounts.store_slow_uncached(0, &pubkey, &account);
}
let ancestors = vec![(0, 0)].into_iter().collect();
let ancestors = Ancestors::from(vec![(0, 0)]);
b.iter(|| {
accounts.load_largest_accounts(
&ancestors,