Update epoch trans. tests to us 16,384 validators
This commit is contained in:
parent
af17fb1d03
commit
3ff8f6ebb3
@ -1,5 +1,5 @@
|
||||
use criterion::Criterion;
|
||||
use criterion::{black_box, criterion_group, criterion_main};
|
||||
use criterion::{black_box, criterion_group, criterion_main, Benchmark};
|
||||
// use env_logger::{Builder, Env};
|
||||
use state_processing::SlotProcessable;
|
||||
use types::beacon_state::BeaconStateBuilder;
|
||||
@ -8,10 +8,9 @@ use types::*;
|
||||
fn epoch_processing(c: &mut Criterion) {
|
||||
// Builder::from_env(Env::default().default_filter_or("debug")).init();
|
||||
|
||||
let mut builder = BeaconStateBuilder::new(8);
|
||||
builder.spec = ChainSpec::few_validators();
|
||||
let mut builder = BeaconStateBuilder::new(16_384);
|
||||
|
||||
builder.build().unwrap();
|
||||
builder.build_fast().unwrap();
|
||||
builder.teleport_to_end_of_epoch(builder.spec.genesis_epoch + 4);
|
||||
|
||||
let mut state = builder.cloned_state();
|
||||
@ -39,19 +38,27 @@ fn epoch_processing(c: &mut Criterion) {
|
||||
let spec_a = builder.spec.clone();
|
||||
let spec_b = builder.spec.clone();
|
||||
|
||||
c.bench_function("epoch processing with pre-built caches", move |b| {
|
||||
b.iter_with_setup(
|
||||
|| cached_state.clone(),
|
||||
|mut state| black_box(state.per_slot_processing(Hash256::zero(), &spec_a).unwrap()),
|
||||
)
|
||||
});
|
||||
c.bench(
|
||||
"epoch processing",
|
||||
Benchmark::new("with pre-built caches", move |b| {
|
||||
b.iter_with_setup(
|
||||
|| cached_state.clone(),
|
||||
|mut state| black_box(state.per_slot_processing(Hash256::zero(), &spec_a).unwrap()),
|
||||
)
|
||||
})
|
||||
.sample_size(10),
|
||||
);
|
||||
|
||||
c.bench_function("epoch processing without pre-built caches", move |b| {
|
||||
b.iter_with_setup(
|
||||
|| cacheless_state.clone(),
|
||||
|mut state| black_box(state.per_slot_processing(Hash256::zero(), &spec_b).unwrap()),
|
||||
)
|
||||
});
|
||||
c.bench(
|
||||
"epoch processing",
|
||||
Benchmark::new("without pre-built caches", move |b| {
|
||||
b.iter_with_setup(
|
||||
|| cacheless_state.clone(),
|
||||
|mut state| black_box(state.per_slot_processing(Hash256::zero(), &spec_b).unwrap()),
|
||||
)
|
||||
})
|
||||
.sample_size(10),
|
||||
);
|
||||
}
|
||||
|
||||
criterion_group!(benches, epoch_processing,);
|
||||
|
Loading…
Reference in New Issue
Block a user