Skip to content

Commit

Permalink
migrate one test to criterion
Browse files Browse the repository at this point in the history
  • Loading branch information
radumarias committed Nov 22, 2024
1 parent 9990356 commit 9dcc026
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions benches/crypto_read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ fn bench_read_1mb_chacha_file(c: &mut Criterion) {
let mut file = file.try_clone().unwrap();
file.seek(io::SeekFrom::Start(0)).unwrap();
let mut reader = crypto::create_read(file, cipher, &key);
black_box(io::copy(&mut reader, &mut io::sink()).unwrap())
black_box(&reader);
io::copy(&mut reader, &mut io::sink()).unwrap();
})
});
}
Expand All @@ -49,7 +50,8 @@ fn bench_read_1mb_aes_file(c: &mut Criterion) {
rand::thread_rng().fill_bytes(cursor_random.get_mut());
cursor_random.seek(io::SeekFrom::Start(0)).unwrap();
io::copy(&mut cursor_random, &mut writer).unwrap();
black_box(writer.finish().unwrap())
black_box(&writer);
writer.finish().unwrap();
})
});
}
Expand All @@ -75,7 +77,8 @@ fn bench_read_1mb_chacha_ram(c: &mut Criterion) {
let mut cursor = cursor_write.clone();
cursor.seek(io::SeekFrom::Start(0)).unwrap();
let mut reader = crypto::create_read(cursor, cipher, &key);
black_box(io::copy(&mut reader, &mut io::sink()).unwrap())
black_box(&reader);
io::copy(&mut reader, &mut io::sink()).unwrap();
})
});
}
Expand All @@ -101,7 +104,8 @@ fn bench_read_1mb_aes_ram(c: &mut Criterion) {
let mut cursor = cursor_write.clone();
cursor.seek(io::SeekFrom::Start(0)).unwrap();
let mut reader = crypto::create_read(cursor, cipher, &key);
black_box(io::copy(&mut reader, &mut io::sink()).unwrap())
black_box(&reader);
io::copy(&mut reader, &mut io::sink()).unwrap();
})
});
}
Expand Down

0 comments on commit 9dcc026

Please sign in to comment.