solana/sdk/benches/slot_history.rs
Ryo Onodera 6d5c6c17c5
Simplify account.rent_epoch handling for sysvar rent (#16049)
* Add some code for special local testing

* Add comment to store_account_and_update_capitalization

* Simplify account.rent_epoch handling for sysvar rent

* Introduce *_for_test functions

* Add deprecation messages to existing api
2021-03-25 15:23:20 +09:00

32 lines
689 B
Rust

#![feature(test)]
extern crate test;
use solana_sdk::{
account::{create_account_for_test, from_account},
slot_history::SlotHistory,
};
use test::Bencher;
#[bench]
fn bench_to_from_account(b: &mut Bencher) {
let mut slot_history = SlotHistory::default();
b.iter(|| {
let account = create_account_for_test(&slot_history);
slot_history = from_account::<SlotHistory, _>(&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;
}
});
}