Skip to content

Commit

Permalink
began adding benches
Browse files Browse the repository at this point in the history
  • Loading branch information
Georg Bramm committed Mar 19, 2022
1 parent 7be5302 commit a26275e
Show file tree
Hide file tree
Showing 6 changed files with 168 additions and 97 deletions.
25 changes: 19 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,30 @@ documentation = "https://docs.rs/rabe"
[lib]
name="rabe"
crate-type=["rlib", "cdylib"]
bench = false
path = "src/lib.rs"

[dependencies]
aes = "0.7.0"
eax = "0.4.1"
pest = "2.0"
pest_derive = "2.0"
permutation = "0.4.0"
rabe-bn = "0.4.18"
rand = "0.8.5"
serde = "1.0.118"
serde_derive = "1.0.118"
aes = "0.7.0"
eax = "0.4.1"
sha3 = "0.9.1"
serde = "1.0.136"
serde_derive = "1.0.136"
sha3 = "0.9.1"

[workspace]

members = [
"rabe-console"
]

[dev-dependencies]
criterion = { version = "0.3", feaures = ["html_reports"]}
rand = "0.8.5"

[[bench]]
name = "rabe"
harness = false
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,13 @@ In order to compile and test:

# Building rabe console app

In order to run on the console use
- go to `console` folder and then run `cargo build --release`
- console app is then available at `/target/release/rabe`
In order to compile and test:
- install rust nightly
- git clone library
- install build-essential
- and then run `cargo run -p rabe-console`

For example, in order to create msk and pk of an AC17 KP-ABE scheme run:
```bash
$ ./target/debug/rabe --scheme AC17KP setup
$ cargo run -p rabe-console -- --scheme AC17KP setup
```
53 changes: 53 additions & 0 deletions benches/rabe.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
extern crate rabe;
#[macro_use]
extern crate criterion;

use criterion::{criterion_group, criterion_main, Criterion, Throughput, BenchmarkId};
use rabe::schemes;


fn criterion_compare_schemes_setup(c: &mut Criterion) {
let mut group = c.benchmark_group("setup");
group.bench_with_input(BenchmarkId::new("AC17", 1), &1_usize, |b, &_usize| {
b.iter(|| {
schemes::ac17::setup()
} );
});
group.bench_with_input(BenchmarkId::new("AW11", 1), &1_usize, |b, &_usize| {
b.iter(|| {
schemes::aw11::setup()
} );
});
group.bench_with_input(BenchmarkId::new("BDABE", 1), &1_usize, |b, &_usize| {
b.iter(|| {
schemes::bdabe::setup()
} );
});
group.bench_with_input(BenchmarkId::new("BSW", 1), &1_usize, |b, &_usize| {
b.iter(|| {
schemes::bsw::setup()
} );
});
group.bench_with_input(BenchmarkId::new("LSW", 1), &1_usize, |b, &_usize| {
b.iter(|| {
schemes::lsw::setup()
} );
});
group.bench_with_input(BenchmarkId::new("MKE08", 1), &1_usize, |b, &_usize| {
b.iter(|| {
schemes::mke08::setup()
} );
});
group.bench_with_input(BenchmarkId::new("YCT14", 1), &1_usize, |b, &_usize| {
b.iter(|| {
schemes::yct14::setup((0..10).into_iter().map(|v: usize| v.to_string()).collect())
} );
});
group.finish();
}

criterion_group!(benches,
criterion_compare_schemes_setup,
);

criterion_main!(benches);
15 changes: 7 additions & 8 deletions console/Cargo.toml → rabe-console/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rabe-console"
version = "0.2.5"
description = "ABE Schemes implemented in rust."
version = "0.2.7"
description = "Console App for the ABE Schemes implemented in rabe."
authors = [
"Schanzenbach, Martin <[email protected]>",
"Bramm, Georg <[email protected]>",
Expand All @@ -22,13 +22,12 @@ path = "src/mod.rs"
base64 = "0.10.1"
deflate = "0.9.0"
inflate = "0.4.5"
blake2-rfc = "0.2.17"
clap = "2.33.3"
rand = "0.7.3"
serde = "1.0.118"
serde_json = "1.0.60"
serde_cbor = "0.11.1"
serde_derive = "1.0.118"
rand = "0.8.5"
serde = "1.0.136"
serde_derive = "1.0.136"
serde_json = "1.0.79"
serde_cbor = "0.11.2"
pest = "2.0"
pest_derive = "2.0"
rabe = { path = "../" }
Loading

0 comments on commit a26275e

Please sign in to comment.