Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parallel tree hashing benchmark #28

Merged
merged 3 commits into from
Sep 5, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions benches/tree_hash_root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,26 @@ pub fn tree_hash_root(c: &mut Criterion) {
})
},
);

c.bench_with_input(
BenchmarkId::new("tree_hash_root_list_parallel", size),
&size,
|b, &size| {
b.iter(|| {
let l1 = List::<u64, C>::try_from_iter(0..size).unwrap();
let mut l2 = List::<u64, C>::try_from_iter(0..size).unwrap();
macladson marked this conversation as resolved.
Show resolved Hide resolved
l2.push(99).unwrap();
l2.apply_updates().unwrap();

let handle = std::thread::spawn(move || {
l1.tree_hash_root();
l2.tree_hash_root();
});
macladson marked this conversation as resolved.
Show resolved Hide resolved

handle.join().unwrap();
});
},
);
}

criterion_group!(benches, tree_hash_root);
Expand Down