Add tree hash benches
This commit is contained in:
parent
f27b62d410
commit
21d75ef0bd
@ -5,7 +5,7 @@ mod epoch_processing_benches;
|
||||
|
||||
criterion_group!(
|
||||
benches,
|
||||
// epoch_processing_benches::epoch_processing_16k_validators,
|
||||
epoch_processing_benches::epoch_processing_16k_validators,
|
||||
block_processing_benches::block_processing_16k_validators,
|
||||
);
|
||||
criterion_main!(benches);
|
||||
|
@ -1,6 +1,7 @@
|
||||
use benching_utils::{BeaconBlockBencher, BeaconStateBencher};
|
||||
use criterion::Criterion;
|
||||
use criterion::{black_box, Benchmark};
|
||||
use ssz::TreeHash;
|
||||
use state_processing::{
|
||||
per_block_processing,
|
||||
per_block_processing::{
|
||||
@ -400,4 +401,13 @@ fn bench_block_processing(
|
||||
})
|
||||
.sample_size(10),
|
||||
);
|
||||
|
||||
let block = initial_block.clone();
|
||||
c.bench(
|
||||
&format!("block_processing_{}", desc),
|
||||
Benchmark::new("tree_hash_block", move |b| {
|
||||
b.iter(|| black_box(block.hash_tree_root()))
|
||||
})
|
||||
.sample_size(10),
|
||||
);
|
||||
}
|
||||
|
@ -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),
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user