Add accounts-bench, a benchmark to test the accounts store speed (#8866)
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user