type AccountSecondaryIndexes = HashSet (#17108)

This commit is contained in:
Jeff Washington (jwash)
2021-05-10 09:22:48 -05:00
committed by GitHub
parent a6a1355b80
commit f39dda00e0
13 changed files with 224 additions and 139 deletions

View File

@ -8,7 +8,7 @@ use rand::Rng;
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
use solana_runtime::{
accounts::{create_test_accounts, AccountAddressFilter, Accounts},
accounts_index::Ancestors,
accounts_index::{AccountSecondaryIndexes, Ancestors},
bank::*,
};
use solana_sdk::{
@ -56,7 +56,7 @@ fn test_accounts_create(bencher: &mut Bencher) {
&[],
None,
None,
HashSet::new(),
AccountSecondaryIndexes::default(),
false,
);
bencher.iter(|| {
@ -75,7 +75,7 @@ fn test_accounts_squash(bencher: &mut Bencher) {
&[],
None,
None,
HashSet::new(),
AccountSecondaryIndexes::default(),
false,
));
let mut pubkeys: Vec<Pubkey> = vec![];
@ -100,7 +100,7 @@ fn test_accounts_hash_bank_hash(bencher: &mut Bencher) {
let accounts = Accounts::new_with_config(
vec![PathBuf::from("bench_accounts_hash_internal")],
&ClusterType::Development,
HashSet::new(),
AccountSecondaryIndexes::default(),
false,
);
let mut pubkeys: Vec<Pubkey> = vec![];
@ -118,7 +118,7 @@ fn test_update_accounts_hash(bencher: &mut Bencher) {
let accounts = Accounts::new_with_config(
vec![PathBuf::from("update_accounts_hash")],
&ClusterType::Development,
HashSet::new(),
AccountSecondaryIndexes::default(),
false,
);
let mut pubkeys: Vec<Pubkey> = vec![];
@ -135,7 +135,7 @@ fn test_accounts_delta_hash(bencher: &mut Bencher) {
let accounts = Accounts::new_with_config(
vec![PathBuf::from("accounts_delta_hash")],
&ClusterType::Development,
HashSet::new(),
AccountSecondaryIndexes::default(),
false,
);
let mut pubkeys: Vec<Pubkey> = vec![];
@ -151,7 +151,7 @@ fn bench_delete_dependencies(bencher: &mut Bencher) {
let accounts = Accounts::new_with_config(
vec![PathBuf::from("accounts_delete_deps")],
&ClusterType::Development,
HashSet::new(),
AccountSecondaryIndexes::default(),
false,
);
let mut old_pubkey = Pubkey::default();
@ -184,7 +184,7 @@ fn store_accounts_with_possible_contention<F: 'static>(
.join(bench_name),
],
&ClusterType::Development,
HashSet::new(),
AccountSecondaryIndexes::default(),
false,
));
let num_keys = 1000;
@ -313,7 +313,7 @@ fn setup_bench_dashmap_iter() -> (Arc<Accounts>, DashMap<Pubkey, (AccountSharedD
.join("bench_dashmap_par_iter"),
],
&ClusterType::Development,
HashSet::new(),
AccountSecondaryIndexes::default(),
false,
));
@ -364,8 +364,12 @@ fn bench_dashmap_iter(bencher: &mut Bencher) {
#[bench]
fn bench_load_largest_accounts(b: &mut Bencher) {
let accounts =
Accounts::new_with_config(Vec::new(), &ClusterType::Development, HashSet::new(), false);
let accounts = Accounts::new_with_config(
Vec::new(),
&ClusterType::Development,
AccountSecondaryIndexes::default(),
false,
);
let mut rng = rand::thread_rng();
for _ in 0..10_000 {
let lamports = rng.gen();

View File

@ -3,9 +3,11 @@
extern crate test;
use rand::{thread_rng, Rng};
use solana_runtime::{accounts_db::AccountInfo, accounts_index::AccountsIndex};
use solana_runtime::{
accounts_db::AccountInfo,
accounts_index::{AccountSecondaryIndexes, AccountsIndex},
};
use solana_sdk::pubkey::{self, Pubkey};
use std::collections::HashSet;
use test::Bencher;
#[bench]
@ -24,7 +26,7 @@ fn bench_accounts_index(bencher: &mut Bencher) {
pubkey,
&Pubkey::default(),
&[],
&HashSet::new(),
&AccountSecondaryIndexes::default(),
AccountInfo::default(),
&mut reclaims,
);
@ -41,7 +43,7 @@ fn bench_accounts_index(bencher: &mut Bencher) {
&pubkeys[pubkey],
&Pubkey::default(),
&[],
&HashSet::new(),
&AccountSecondaryIndexes::default(),
AccountInfo::default(),
&mut reclaims,
);