Add ssz benches to state processing
This commit is contained in:
parent
834c36d602
commit
6311b13169
@ -15,6 +15,7 @@ serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
lazy_static = "0.1"
|
||||
serde_yaml = "0.8"
|
||||
eth2_ssz = { path = "../utils/ssz" }
|
||||
beacon_chain = { path = "../../beacon_node/beacon_chain" }
|
||||
store = { path = "../../beacon_node/store" }
|
||||
lmd_ghost = { path = "../lmd_ghost" }
|
||||
|
@ -2,6 +2,7 @@ extern crate env_logger;
|
||||
|
||||
use criterion::Criterion;
|
||||
use criterion::{black_box, criterion_group, criterion_main, Benchmark};
|
||||
use ssz::Encode;
|
||||
use state_processing::{test_utils::BlockBuilder, BlockSignatureStrategy, VerifySignatures};
|
||||
use types::{BeaconBlock, BeaconState, ChainSpec, EthSpec, MainnetEthSpec, MinimalEthSpec, Slot};
|
||||
|
||||
@ -393,6 +394,32 @@ fn bench_block<T: EthSpec>(
|
||||
})
|
||||
.sample_size(10),
|
||||
);
|
||||
|
||||
let local_block = block.clone();
|
||||
c.bench(
|
||||
&title,
|
||||
Benchmark::new("ssz_serialize_block", move |b| {
|
||||
b.iter_batched_ref(
|
||||
|| (),
|
||||
|_| black_box(local_block.as_ssz_bytes()),
|
||||
criterion::BatchSize::SmallInput,
|
||||
)
|
||||
})
|
||||
.sample_size(10),
|
||||
);
|
||||
|
||||
let local_block = block.clone();
|
||||
c.bench(
|
||||
&title,
|
||||
Benchmark::new("ssz_block_len", move |b| {
|
||||
b.iter_batched_ref(
|
||||
|| (),
|
||||
|_| black_box(local_block.ssz_bytes_len()),
|
||||
criterion::BatchSize::SmallInput,
|
||||
)
|
||||
})
|
||||
.sample_size(10),
|
||||
);
|
||||
}
|
||||
|
||||
criterion_group!(benches, all_benches,);
|
||||
|
Loading…
Reference in New Issue
Block a user