Add accounts-bench, a benchmark to test the accounts store speed (#8866)

This commit is contained in:
sakridge
2020-03-17 11:02:07 -07:00
committed by GitHub
parent 55907b2167
commit 2435c3ce0c
6 changed files with 149 additions and 1 deletions

View File

@ -12,6 +12,7 @@ use crate::{
transaction_utils::OrderedIterator,
};
use log::*;
use rand::{thread_rng, Rng};
use rayon::slice::ParallelSliceMut;
use solana_sdk::{
account::Account,
@ -658,6 +659,14 @@ pub fn create_test_accounts(
}
}
pub fn update_accounts(accounts: &Accounts, pubkeys: &[Pubkey], slot: u64) {
for pubkey in pubkeys {
let amount = thread_rng().gen_range(0, 10);
let account = Account::new(amount, 0, &Account::default().owner);
accounts.store_slow(slot, &pubkey, &account);
}
}
#[cfg(test)]
mod tests {
// TODO: all the bank tests are bank specific, issue: 2194