Add method for dropping pubkey cache. Add bench.
This commit is contained in:
parent
6cd3c4bd1a
commit
587be831b5
@ -426,6 +426,23 @@ fn bench_block_processing(
|
|||||||
.sample_size(10),
|
.sample_size(10),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let mut state = initial_state.clone();
|
||||||
|
state.drop_pubkey_cache();
|
||||||
|
c.bench(
|
||||||
|
&format!("{}/block_processing", desc),
|
||||||
|
Benchmark::new("build_pubkey_cache", move |b| {
|
||||||
|
b.iter_batched(
|
||||||
|
|| state.clone(),
|
||||||
|
|mut state| {
|
||||||
|
state.update_pubkey_cache().unwrap();
|
||||||
|
state
|
||||||
|
},
|
||||||
|
criterion::BatchSize::SmallInput,
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.sample_size(10),
|
||||||
|
);
|
||||||
|
|
||||||
let block = initial_block.clone();
|
let block = initial_block.clone();
|
||||||
c.bench(
|
c.bench(
|
||||||
&format!("{}/block_processing", desc),
|
&format!("{}/block_processing", desc),
|
||||||
|
@ -322,6 +322,11 @@ impl BeaconState {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Completely drops the `pubkey_cache`, replacing it with a new, empty cache.
|
||||||
|
pub fn drop_pubkey_cache(&mut self) {
|
||||||
|
self.pubkey_cache = PubkeyCache::empty()
|
||||||
|
}
|
||||||
|
|
||||||
/// If a validator pubkey exists in the validator registry, returns `Some(i)`, otherwise
|
/// If a validator pubkey exists in the validator registry, returns `Some(i)`, otherwise
|
||||||
/// returns `None`.
|
/// returns `None`.
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user