Skip to content
This repository has been archived by the owner on Jun 29, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from nvzqz/patch-1
Browse files Browse the repository at this point in the history
Use runtime arguments in Divan benchmarks
  • Loading branch information
codahale committed Jan 21, 2024
2 parents 9f52952 + f51c8a2 commit 46297c6
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ digest = { version = "0.10.7", default-features = false, features = ["block-buff
hex-literal = "0.4.1"

[dev-dependencies]
divan = "0.1.2"
divan = "0.1.11"
expect-test = "1.4.1"
hex = "0.4.3"
quickcheck = "1.0.3"
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ publish = false
[dependencies]
areion = { path = ".." }
blake3 = "1.5.0"
divan = "0.1.2"
divan = "0.1.11"
sha2 = { version = "0.10.6", default-features = false, features = ["asm"] }

[[bench]]
Expand Down
56 changes: 28 additions & 28 deletions benchmarks/benches/benchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,59 +44,59 @@ fn areion512_dm(b: Bencher) {

const LENS: &[usize] = &[16, 256, 1024, 16 * 1024, 1024 * 1024];

#[divan::bench(consts = LENS)]
fn areion512_md<const LEN: usize>(bencher: divan::Bencher) {
#[divan::bench(args = LENS)]
fn areion512_md(bencher: divan::Bencher, len: usize) {
bencher
.with_inputs(|| vec![0u8; LEN])
.counter(BytesCount::new(LEN))
.with_inputs(|| vec![0u8; len])
.counter(BytesCount::new(len))
.bench_refs(|block| areion::Areion512Md::default().chain_update(block).finalize());
}

#[divan::bench(consts = LENS)]
fn areion512_mmo<const LEN: usize>(bencher: divan::Bencher) {
#[divan::bench(args = LENS)]
fn areion512_mmo(bencher: divan::Bencher, len: usize) {
bencher
.with_inputs(|| vec![0u8; LEN])
.counter(BytesCount::new(LEN))
.with_inputs(|| vec![0u8; len])
.counter(BytesCount::new(len))
.bench_refs(|block| areion::Areion512Mmo::default().chain_update(block).finalize());
}

#[divan::bench(consts = LENS)]
fn areion256_512_sponge<const LEN: usize>(bencher: divan::Bencher) {
#[divan::bench(args = LENS)]
fn areion256_512_sponge(bencher: divan::Bencher, len: usize) {
bencher
.with_inputs(|| vec![0u8; LEN])
.counter(BytesCount::new(LEN))
.with_inputs(|| vec![0u8; len])
.counter(BytesCount::new(len))
.bench_refs(|block| Areion256Sponge::new().chain_update(block).finalize());
}

#[divan::bench(consts = LENS)]
fn areion512_haifa<const LEN: usize>(bencher: divan::Bencher) {
#[divan::bench(args = LENS)]
fn areion512_haifa(bencher: divan::Bencher, len: usize) {
bencher
.with_inputs(|| vec![0u8; LEN])
.counter(BytesCount::new(LEN))
.with_inputs(|| vec![0u8; len])
.counter(BytesCount::new(len))
.bench_refs(|block| AreionHaifa512::new().chain_update(block).finalize());
}

#[divan::bench(consts = LENS)]
fn sha256<const LEN: usize>(bencher: divan::Bencher) {
#[divan::bench(args = LENS)]
fn sha256(bencher: divan::Bencher, len: usize) {
bencher
.with_inputs(|| vec![0u8; LEN])
.counter(BytesCount::new(LEN))
.with_inputs(|| vec![0u8; len])
.counter(BytesCount::new(len))
.bench_refs(|block| Sha256::new().chain_update(block).finalize());
}

#[divan::bench(consts = LENS)]
fn blake3<const LEN: usize>(bencher: divan::Bencher) {
#[divan::bench(args = LENS)]
fn blake3(bencher: divan::Bencher, len: usize) {
bencher
.with_inputs(|| vec![0u8; LEN])
.counter(BytesCount::new(LEN))
.with_inputs(|| vec![0u8; len])
.counter(BytesCount::new(len))
.bench_refs(|block| blake3::hash(block));
}

#[divan::bench(consts = LENS)]
fn sha512<const LEN: usize>(bencher: divan::Bencher) {
#[divan::bench(args = LENS)]
fn sha512(bencher: divan::Bencher, len: usize) {
bencher
.with_inputs(|| vec![0u8; LEN])
.counter(BytesCount::new(LEN))
.with_inputs(|| vec![0u8; len])
.counter(BytesCount::new(len))
.bench_refs(|block| Sha512::new().chain_update(block).finalize());
}

Expand Down

0 comments on commit 46297c6

Please sign in to comment.