Add tree hash benches

This commit is contained in:
Paul Hauner
2019-03-10 18:31:14 +11:00
parent f27b62d410
commit 21d75ef0bd
3 changed files with 24 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
use benching_utils::BeaconStateBencher;
use criterion::Criterion;
use criterion::{black_box, Benchmark};
use ssz::TreeHash;
use state_processing::{
per_epoch_processing,
per_epoch_processing::{
@@ -328,4 +329,16 @@ fn bench_epoch_processing(c: &mut Criterion, state: &BeaconState, spec: &ChainSp
})
.sample_size(SMALL_BENCHING_SAMPLE_SIZE),
);
let state_clone = state.clone();
c.bench(
&format!("epoch_process_with_caches_{}", desc),
Benchmark::new("tree_hash_state", move |b| {
b.iter_with_setup(
|| state_clone.clone(),
|state| black_box(state.hash_tree_root()),
)
})
.sample_size(SMALL_BENCHING_SAMPLE_SIZE),
);
}