chore: improve Nibbles-related code (#5631)

This commit is contained in:
DaniPopes
2023-11-30 20:28:50 +01:00
committed by GitHub
parent a4ed76d058
commit 0d522e8472
23 changed files with 313 additions and 233 deletions

View File

@ -3,17 +3,12 @@ use reth_primitives::trie::Nibbles;
/// Benchmarks the nibble unpacking.
pub fn nibbles_benchmark(c: &mut Criterion) {
c.bench_function("Nibbles unpack", |b| {
let mut g = c.benchmark_group("nibbles");
g.bench_function("unpack", |b| {
let raw = (1..=32).collect::<Vec<u8>>();
b.iter(|| {
Nibbles::unpack(&raw);
})
b.iter(|| Nibbles::unpack(&raw))
});
}
criterion_group! {
name = benches;
config = Criterion::default();
targets = nibbles_benchmark
}
criterion_group!(benches, nibbles_benchmark);
criterion_main!(benches);