Skip to content

Commit dbaba3d

Browse files
committed
also include digest byte length when computing cycles/byte
Signed-off-by: Anjan Roy <hello@itzmeanjan.in>
1 parent e24f707 commit dbaba3d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

benches/turboshake.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type CriterionHandler = Criterion<CyclesPerByte>;
2424
type CriterionHandler = Criterion;
2525

2626
fn turboshake128(c: &mut CriterionHandler) {
27-
const DIGEST_LEN: usize = 32;
27+
const DIGEST_LEN: usize = 64;
2828
const MIN_MSG_LEN: usize = 32;
2929
const MAX_MSG_LEN: usize = 4096;
3030

@@ -33,7 +33,7 @@ fn turboshake128(c: &mut CriterionHandler) {
3333
let mut mlen = MIN_MSG_LEN;
3434
while mlen <= MAX_MSG_LEN {
3535
let mut group = c.benchmark_group("turboshake128");
36-
group.throughput(Throughput::Bytes(mlen as u64));
36+
group.throughput(Throughput::Bytes((mlen + DIGEST_LEN) as u64));
3737

3838
group.bench_function(&format!("{}/{} (cached)", mlen, DIGEST_LEN), |bench| {
3939
let mut msg = vec![0u8; mlen];
@@ -70,7 +70,7 @@ fn turboshake128(c: &mut CriterionHandler) {
7070
}
7171

7272
fn turboshake256(c: &mut CriterionHandler) {
73-
const DIGEST_LEN: usize = 32;
73+
const DIGEST_LEN: usize = 64;
7474
const MIN_MSG_LEN: usize = 32;
7575
const MAX_MSG_LEN: usize = 4096;
7676

@@ -79,7 +79,7 @@ fn turboshake256(c: &mut CriterionHandler) {
7979
let mut mlen = MIN_MSG_LEN;
8080
while mlen <= MAX_MSG_LEN {
8181
let mut group = c.benchmark_group("turboshake256");
82-
group.throughput(Throughput::Bytes(mlen as u64));
82+
group.throughput(Throughput::Bytes((mlen + DIGEST_LEN) as u64));
8383

8484
group.bench_function(&format!("{}/{} (cached)", mlen, DIGEST_LEN), |bench| {
8585
let mut msg = vec![0u8; mlen];

0 commit comments

Comments
 (0)