mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
perf(trie): prealloc in Nibble::unpack (#5629)
This commit is contained in:
19
crates/primitives/benches/nibbles.rs
Normal file
19
crates/primitives/benches/nibbles.rs
Normal file
@ -0,0 +1,19 @@
|
||||
use criterion::{criterion_group, criterion_main, Criterion};
|
||||
use reth_primitives::trie::Nibbles;
|
||||
|
||||
/// Benchmarks the nibble unpacking.
|
||||
pub fn nibbles_benchmark(c: &mut Criterion) {
|
||||
c.bench_function("Nibbles unpack", |b| {
|
||||
let raw = (1..=32).collect::<Vec<u8>>();
|
||||
b.iter(|| {
|
||||
Nibbles::unpack(&raw);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
criterion_group! {
|
||||
name = benches;
|
||||
config = Criterion::default();
|
||||
targets = nibbles_benchmark
|
||||
}
|
||||
criterion_main!(benches);
|
||||
Reference in New Issue
Block a user