summaryrefslogtreecommitdiffstats
path: root/openpgp/benches/random.rs
diff options
context:
space:
mode:
Diffstat (limited to 'openpgp/benches/random.rs')
-rw-r--r--openpgp/benches/random.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/openpgp/benches/random.rs b/openpgp/benches/random.rs
new file mode 100644
index 00000000..af8e4b9a
--- /dev/null
+++ b/openpgp/benches/random.rs
@@ -0,0 +1,16 @@
+use criterion::{black_box, criterion_group, criterion_main, AxisScale, Criterion, BenchmarkId, PlotConfiguration};
+
+use sequoia_openpgp::crypto;
+use sequoia_openpgp::parse::Parse;
+
+fn test_random() {
+ let mut buf = vec![0; 32];
+ crypto::random(&mut buf);
+}
+
+fn bench_random(c: &mut Criterion) {
+ c.bench_function("crypto::random", |b| b.iter(|| test_random() ));
+}
+
+criterion_group!(benches, bench_random);
+criterion_main!(benches);