-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
303 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#![feature(test)] | ||
|
||
extern crate solana_core; | ||
extern crate test; | ||
|
||
use solana_core::consensus::Tower; | ||
use solana_ledger::bank_forks::BankForks; | ||
use solana_runtime::bank::Bank; | ||
use solana_sdk::{ | ||
pubkey::Pubkey, | ||
signature::{Keypair, Signer}, | ||
}; | ||
use std::sync::Arc; | ||
use tempfile::TempDir; | ||
use test::Bencher; | ||
|
||
#[bench] | ||
fn bench_save_tower(bench: &mut Bencher) { | ||
let dir = TempDir::new().unwrap(); | ||
let path = dir.path(); | ||
|
||
let vote_account_pubkey = &Pubkey::default(); | ||
let node_keypair = Arc::new(Keypair::new()); | ||
let tower = Tower::new( | ||
&node_keypair.pubkey(), | ||
&vote_account_pubkey, | ||
&BankForks::new(0, Bank::default()), | ||
&path, | ||
); | ||
|
||
bench.iter(move || { | ||
tower.save(&node_keypair).unwrap(); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.