mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-19 13:58:28 +00:00
Add ssz benches to state processing
This commit is contained in:
@@ -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,);
|
||||
|
||||
Reference in New Issue
Block a user