Fix unrealistic hash rate expectations in genesis (#6295)
This commit is contained in:
parent
72d227ae91
commit
de82e60c64
|
@ -3426,6 +3426,7 @@ dependencies = [
|
|||
"base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bincode 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rayon 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -3436,6 +3437,7 @@ dependencies = [
|
|||
"solana-stake-api 0.20.0",
|
||||
"solana-storage-api 0.20.0",
|
||||
"solana-vote-api 0.20.0",
|
||||
"sys-info 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
|
|
@ -23,3 +23,5 @@ solana-stake-api = { path = "../programs/stake_api", version = "0.20.0" }
|
|||
solana-storage-api = { path = "../programs/storage_api", version = "0.20.0" }
|
||||
solana-vote-api = { path = "../programs/vote_api", version = "0.20.0" }
|
||||
tempfile = "3.1.0"
|
||||
sys-info = "0.5.8"
|
||||
rayon = "1.2.0"
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
use base64;
|
||||
use clap::{crate_description, crate_name, crate_version, value_t_or_exit, App, Arg};
|
||||
use rayon::iter::{IntoParallelIterator, ParallelIterator};
|
||||
use solana_core::blocktree::create_new_ledger;
|
||||
use solana_genesis::PrimordialAccountDetails;
|
||||
use solana_sdk::{
|
||||
|
@ -376,12 +377,18 @@ fn main() -> Result<(), Box<dyn error::Error>> {
|
|||
|
||||
match matches.value_of("hashes_per_tick").unwrap() {
|
||||
"auto" => {
|
||||
let mut v = Hash::default();
|
||||
println!("Running 1 million hashes...");
|
||||
let v = Hash::default();
|
||||
// calculate hash rate with the system under maximum load
|
||||
println!("Running 1 million hashes in parallel on all threads...");
|
||||
let start = Instant::now();
|
||||
for _ in 0..1_000_000 {
|
||||
v = hash(&v.as_ref());
|
||||
}
|
||||
(0..sys_info::cpu_num().unwrap())
|
||||
.into_par_iter()
|
||||
.for_each_with(v, |v, _| {
|
||||
for _ in 0..1_000_000 {
|
||||
*v = hash(&v.as_ref());
|
||||
}
|
||||
});
|
||||
|
||||
let end = Instant::now();
|
||||
let elapsed = end.duration_since(start).as_millis();
|
||||
|
||||
|
|
Loading…
Reference in New Issue