aboutsummaryrefslogtreecommitdiff
path: root/rand/rand_jitter/benches/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rand/rand_jitter/benches/mod.rs')
-rw-r--r--rand/rand_jitter/benches/mod.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/rand/rand_jitter/benches/mod.rs b/rand/rand_jitter/benches/mod.rs
new file mode 100644
index 0000000..bf7c8a2
--- /dev/null
+++ b/rand/rand_jitter/benches/mod.rs
@@ -0,0 +1,17 @@
+#![feature(test)]
+#![cfg(std)]
+
+use test::Bencher;
+use rand_jitter::rand_core::RngCore;
+
+#[bench]
+fn bench_add_two(b: &mut Bencher) {
+ let mut rng = rand_jitter::JitterRng::new().unwrap();
+ let mut buf = [0u8; 1024];
+ b.iter(|| {
+ rng.fill_bytes(&mut buf[..]);
+ test::black_box(&buf);
+ });
+ b.bytes = buf.len() as u64;
+}
+