Skip to content

Commit

Permalink
xof benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
oconnor663 committed Jul 15, 2023
1 parent b0e1e38 commit 7068a1b
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,3 +342,36 @@ fn bench_two_updates(b: &mut Bencher) {
hasher.finalize()
});
}

fn bench_xof(b: &mut Bencher, len: usize) {
b.bytes = len as u64;
let mut output = [0u8; 65536];
let output_slice = &mut output[..len];
let mut reader = blake3::Hasher::new().finalize_xof();
b.iter(|| reader.fill(output_slice));
}

#[bench]
fn bench_xof_0064(b: &mut Bencher) {
bench_xof(b, 64);
}

#[bench]
fn bench_xof_0128(b: &mut Bencher) {
bench_xof(b, 64);
}

#[bench]
fn bench_xof_0256(b: &mut Bencher) {
bench_xof(b, 64);
}

#[bench]
fn bench_xof_0512(b: &mut Bencher) {
bench_xof(b, 64);
}

#[bench]
fn bench_xof_1024(b: &mut Bencher) {
bench_xof(b, 64);
}

0 comments on commit 7068a1b

Please sign in to comment.