mirror of
https://github.com/vacp2p/zerokit.git
synced 2026-01-10 06:58:03 -05:00
Add batch setup to the imt setup group
This commit is contained in:
@@ -102,11 +102,11 @@ fn benchy_prototype_code() {
|
||||
}
|
||||
|
||||
pub fn imt_benchy(c: &mut Criterion) {
|
||||
let mut group = c.benchmark_group("markle tree setup");
|
||||
let mut group = c.benchmark_group("merkle tree setup");
|
||||
|
||||
for size in [7u32, 13, 17].iter() {
|
||||
group.bench_with_input(
|
||||
BenchmarkId::new("Lean IMT setup", size),
|
||||
BenchmarkId::new("Lean IMT setup incremental", size),
|
||||
size,
|
||||
|b, &size| {
|
||||
b.iter_batched(
|
||||
@@ -129,6 +129,29 @@ pub fn imt_benchy(c: &mut Criterion) {
|
||||
)
|
||||
},
|
||||
);
|
||||
group.bench_with_input(
|
||||
BenchmarkId::new("Lean IMT setup batch", size),
|
||||
size,
|
||||
|b, &size| {
|
||||
b.iter_batched(
|
||||
// Setup: create values for each benchmark iteration
|
||||
|| {
|
||||
let data_source: Vec<[u8; 32]> = HashMockStream::seeded_stream(42)
|
||||
.take(size as usize)
|
||||
.collect()
|
||||
;
|
||||
let tree = HashedLeanIMT::<32, BenchyIFTHasher>::new(&[], BenchyIFTHasher)
|
||||
.unwrap();
|
||||
(tree, data_source)
|
||||
},
|
||||
// Actual benchmark
|
||||
|(mut tree, data_source)| {
|
||||
tree.insert_many(&data_source[..])
|
||||
},
|
||||
BatchSize::SmallInput,
|
||||
)
|
||||
},
|
||||
);
|
||||
}
|
||||
group.finish();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user