* address warnings from 'rustup run beta cargo clippy --workspace' minor refactoring in: - cli/src/cli.rs - cli/src/offline/blockhash_query.rs - logger/src/lib.rs - runtime/src/accounts_db.rs expect some performance improvement AccountsDB::clean_accounts() * address warnings from 'rustup run beta cargo clippy --workspace --tests' * address warnings from 'rustup run nightly cargo clippy --workspace --all-targets' * rustfmt * fix warning stragglers * properly fix clippy warnings test_vote_subscribe() replace ref-to-arc with ref parameters where arc not cloned * Remove lock around JsonRpcRequestProcessor (#10417) automerge * make ancestors parameter optional to avoid forcing construction of empty hash maps Co-authored-by: Greg Fitzgerald <greg@solana.com>
29 lines
631 B
Rust
29 lines
631 B
Rust
#![feature(test)]
|
|
|
|
extern crate test;
|
|
use solana_sdk::{slot_history::SlotHistory, sysvar::Sysvar};
|
|
use test::Bencher;
|
|
|
|
#[bench]
|
|
fn bench_to_from_account(b: &mut Bencher) {
|
|
let mut slot_history = SlotHistory::default();
|
|
|
|
b.iter(|| {
|
|
let account = slot_history.create_account(0);
|
|
slot_history = SlotHistory::from_account(&account).unwrap();
|
|
});
|
|
}
|
|
|
|
#[bench]
|
|
fn bench_slot_history_add_new(b: &mut Bencher) {
|
|
let mut slot_history = SlotHistory::default();
|
|
|
|
let mut slot = 0;
|
|
b.iter(|| {
|
|
for _ in 0..5 {
|
|
slot_history.add(slot);
|
|
slot += 100_000;
|
|
}
|
|
});
|
|
}
|