runtime: Add bench for accounts::hash_internal_state (#5157)

* runtime: Add bench for accounts::hash_internal_state

* fixup! cargo fmt

* fixup! cargo clippy

* fixup! Use a more representitive number of accounts

* fixup! More descriptive name for accounts creation helper
This commit is contained in:
Trent Nelson
2019-07-19 10:32:29 -06:00
committed by GitHub
parent 8b69998379
commit 111d0eb89b
3 changed files with 22 additions and 11 deletions

View File

@ -2,6 +2,7 @@
extern crate test;
use solana_runtime::accounts::{create_test_accounts, Accounts};
use solana_runtime::bank::*;
use solana_sdk::account::Account;
use solana_sdk::genesis_block::create_genesis_block;
@ -56,3 +57,13 @@ fn test_accounts_squash(bencher: &mut Bencher) {
banks[1].squash();
});
}
#[bench]
fn test_accounts_hash_internal_state(bencher: &mut Bencher) {
let accounts = Accounts::new(Some("bench_accounts_hash_internal".to_string()));
let mut pubkeys: Vec<Pubkey> = vec![];
create_test_accounts(&accounts, &mut pubkeys, 60000);
bencher.iter(|| {
accounts.hash_internal_state(0);
});
}