Added benchmark
This commit is contained in:
parent
1726d45647
commit
70214e1b6f
12
Cargo.toml
12
Cargo.toml
|
@ -3,7 +3,7 @@ name = "false-bottom"
|
|||
version = "0.1.0"
|
||||
description = "A deniable encryption scheme"
|
||||
repository = "https://codeberg.org/skran/false-bottom"
|
||||
author = ["K Shiva Kiran <shiva_kr@riseup.net>"]
|
||||
authors = ["K Shiva Kiran <shiva_kr@riseup.net>"]
|
||||
license = "GPL-3.0-or-later"
|
||||
edition = "2021"
|
||||
|
||||
|
@ -14,6 +14,14 @@ crypto-bigint = {version = "0.5.5", features = ["generic-array"]}
|
|||
base64 = "0.21.7"
|
||||
bincode = "1.3.3"
|
||||
typenum = "1.17.0"
|
||||
rayon = "1.10.0"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
doctest = false
|
||||
|
||||
[dev-dependencies]
|
||||
criterion = "0.5.1"
|
||||
|
||||
[[bench]]
|
||||
name = "bench"
|
||||
harness = false
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
use criterion::*;
|
||||
use false_bottom::{FB128, FBAlgo};
|
||||
|
||||
pub fn bench(c: &mut Criterion) {
|
||||
let inp = vec![0_u8; 4096000];
|
||||
let mut fb = FB128::init(2, 2).unwrap();
|
||||
let mut group = c.benchmark_group("bench-group");
|
||||
let key = fb.add(&inp);
|
||||
group.sample_size(21);
|
||||
group.throughput(Throughput::Bytes(inp.len() as u64));
|
||||
group.bench_with_input(
|
||||
BenchmarkId::new("4MB null bytes encryption", 4), &inp,
|
||||
|b, inp| b.iter(|| {
|
||||
fb.add(&inp)
|
||||
}),
|
||||
);
|
||||
group.bench_with_input(
|
||||
BenchmarkId::new("4MB null bytes decryption", 4), &key,
|
||||
|b, key| b.iter(|| {
|
||||
fb.decrypt(&key)
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
criterion_group!(benches, bench);
|
||||
criterion_main!(benches);
|
Loading…
Reference in New Issue