Move benching_utils structs into types

This commit is contained in:
Paul Hauner
2019-03-11 11:17:27 +11:00
parent 6ae99a1462
commit 0b7082e2b9
12 changed files with 25 additions and 54 deletions

View File

@@ -1,4 +1,3 @@
use benching_utils::{BeaconBlockBencher, BeaconStateBencher};
use criterion::Criterion;
use criterion::{black_box, Benchmark};
use ssz::TreeHash;
@@ -10,6 +9,7 @@ use state_processing::{
verify_block_signature,
},
};
use types::test_utils::{TestingBeaconBlockBuilder, TestingBeaconStateBuilder};
use types::*;
/// Run the benchmarking suite on a foundation spec with 16,384 validators.
@@ -82,7 +82,7 @@ pub fn block_processing_16k_validators(c: &mut Criterion) {
}
fn build_state(validator_count: usize, spec: &ChainSpec) -> (BeaconState, Vec<Keypair>) {
let mut builder = BeaconStateBencher::new(validator_count, &spec);
let mut builder = TestingBeaconStateBuilder::new(validator_count, &spec);
// Set the state to be just before an epoch transition.
let target_slot = (spec.genesis_epoch + 4).end_slot(spec.slots_per_epoch);
@@ -95,7 +95,7 @@ fn build_state(validator_count: usize, spec: &ChainSpec) -> (BeaconState, Vec<Ke
}
fn build_block(state: &mut BeaconState, keypairs: &[Keypair], spec: &ChainSpec) -> BeaconBlock {
let mut builder = BeaconBlockBencher::new(spec);
let mut builder = TestingBeaconBlockBuilder::new(spec);
builder.set_slot(state.slot);

View File

@@ -1,4 +1,3 @@
use benching_utils::BeaconStateBencher;
use criterion::Criterion;
use criterion::{black_box, Benchmark};
use ssz::TreeHash;
@@ -11,6 +10,7 @@ use state_processing::{
update_latest_slashed_balances,
},
};
use types::test_utils::TestingBeaconStateBuilder;
use types::{validator_registry::get_active_validator_indices, *};
pub const BENCHING_SAMPLE_SIZE: usize = 10;
@@ -22,7 +22,7 @@ pub fn epoch_processing_16k_validators(c: &mut Criterion) {
let validator_count = 300_032;
let mut builder = BeaconStateBencher::new(validator_count, &spec);
let mut builder = TestingBeaconStateBuilder::new(validator_count, &spec);
// Set the state to be just before an epoch transition.
let target_slot = (spec.genesis_epoch + 4).end_slot(spec.slots_per_epoch);