* move Account to solana-sdk (#13198)
(cherry picked from commit c458d4b213
)
# Conflicts:
# programs/bpf/benches/bpf_loader.rs
* resolve conflicts
Co-authored-by: Jack May <jack@solana.com>
22 lines
530 B
Rust
22 lines
530 B
Rust
#![feature(test)]
|
|
|
|
extern crate test;
|
|
use solana_sdk::{
|
|
account::{create_account, from_account},
|
|
hash::Hash,
|
|
slot_hashes::{Slot, SlotHashes, MAX_ENTRIES},
|
|
};
|
|
use test::Bencher;
|
|
|
|
#[bench]
|
|
fn bench_to_from_account(b: &mut Bencher) {
|
|
let mut slot_hashes = SlotHashes::new(&[]);
|
|
for i in 0..MAX_ENTRIES {
|
|
slot_hashes.add(i as Slot, Hash::default());
|
|
}
|
|
b.iter(|| {
|
|
let account = create_account(&slot_hashes, 0);
|
|
slot_hashes = from_account::<SlotHashes>(&account).unwrap();
|
|
});
|
|
}
|