Add secondary indexes (#14212)
This commit is contained in:
@ -14,7 +14,7 @@ use solana_sdk::{
|
||||
pubkey::Pubkey,
|
||||
};
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
collections::{HashMap, HashSet},
|
||||
path::PathBuf,
|
||||
sync::{Arc, RwLock},
|
||||
thread::Builder,
|
||||
@ -49,6 +49,7 @@ fn test_accounts_create(bencher: &mut Bencher) {
|
||||
&[],
|
||||
None,
|
||||
None,
|
||||
HashSet::new(),
|
||||
);
|
||||
bencher.iter(|| {
|
||||
let mut pubkeys: Vec<Pubkey> = vec![];
|
||||
@ -66,6 +67,7 @@ fn test_accounts_squash(bencher: &mut Bencher) {
|
||||
&[],
|
||||
None,
|
||||
None,
|
||||
HashSet::new(),
|
||||
));
|
||||
let mut pubkeys: Vec<Pubkey> = vec![];
|
||||
deposit_many(&bank1, &mut pubkeys, 250_000);
|
||||
|
@ -4,7 +4,8 @@ extern crate test;
|
||||
|
||||
use rand::{thread_rng, Rng};
|
||||
use solana_runtime::{accounts_db::AccountInfo, accounts_index::AccountsIndex};
|
||||
use solana_sdk::pubkey;
|
||||
use solana_sdk::pubkey::{self, Pubkey};
|
||||
use std::collections::HashSet;
|
||||
use test::Bencher;
|
||||
|
||||
#[bench]
|
||||
@ -18,7 +19,15 @@ fn bench_accounts_index(bencher: &mut Bencher) {
|
||||
let index = AccountsIndex::<AccountInfo>::default();
|
||||
for f in 0..NUM_FORKS {
|
||||
for pubkey in pubkeys.iter().take(NUM_PUBKEYS) {
|
||||
index.upsert(f, pubkey, AccountInfo::default(), &mut reclaims);
|
||||
index.upsert(
|
||||
f,
|
||||
pubkey,
|
||||
&Pubkey::default(),
|
||||
&[],
|
||||
&HashSet::new(),
|
||||
AccountInfo::default(),
|
||||
&mut reclaims,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,6 +39,9 @@ fn bench_accounts_index(bencher: &mut Bencher) {
|
||||
index.upsert(
|
||||
fork,
|
||||
&pubkeys[pubkey],
|
||||
&Pubkey::default(),
|
||||
&[],
|
||||
&HashSet::new(),
|
||||
AccountInfo::default(),
|
||||
&mut reclaims,
|
||||
);
|
||||
|
Reference in New Issue
Block a user