Skip to content

Commit

Permalink
rand_seeder: add benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
dhardy committed Jul 27, 2018
1 parent b37c70d commit 7b7dc79
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ wasm-bindgen = { version = "0.2.12", optional = true }
[dev-dependencies]
# This has a histogram implementation used for testing uniformity.
average = "0.9.2"
# for benchmarking
rand_seeder = { path = "rand_seeder", version = "0.1" }

[build-dependencies]
rustc_version = "0.2"
Expand Down
6 changes: 6 additions & 0 deletions benches/generators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
extern crate test;
extern crate rand;
extern crate rand_isaac;
extern crate rand_seeder;
extern crate rand_xorshift;

const RAND_BENCH_N: u64 = 1000;
Expand All @@ -17,6 +18,7 @@ use rand::prng::hc128::Hc128Core;
use rand::rngs::adapter::ReseedingRng;
use rand::rngs::{OsRng, JitterRng, EntropyRng};
use rand_isaac::{IsaacRng, Isaac64Rng};
use rand_seeder::SipRng;
use rand_xorshift::XorShiftRng;

macro_rules! gen_bytes {
Expand All @@ -41,6 +43,7 @@ gen_bytes!(gen_bytes_chacha20, ChaChaRng::from_entropy());
gen_bytes!(gen_bytes_hc128, Hc128Rng::from_entropy());
gen_bytes!(gen_bytes_isaac, IsaacRng::from_entropy());
gen_bytes!(gen_bytes_isaac64, Isaac64Rng::from_entropy());
gen_bytes!(gen_bytes_sip, SipRng::from_entropy());
gen_bytes!(gen_bytes_std, StdRng::from_entropy());
gen_bytes!(gen_bytes_small, SmallRng::from_entropy());
gen_bytes!(gen_bytes_os, OsRng::new().unwrap());
Expand All @@ -67,6 +70,7 @@ gen_uint!(gen_u32_chacha20, u32, ChaChaRng::from_entropy());
gen_uint!(gen_u32_hc128, u32, Hc128Rng::from_entropy());
gen_uint!(gen_u32_isaac, u32, IsaacRng::from_entropy());
gen_uint!(gen_u32_isaac64, u32, Isaac64Rng::from_entropy());
gen_uint!(gen_u32_sip, u32, SipRng::from_entropy());
gen_uint!(gen_u32_std, u32, StdRng::from_entropy());
gen_uint!(gen_u32_small, u32, SmallRng::from_entropy());
gen_uint!(gen_u32_os, u32, OsRng::new().unwrap());
Expand All @@ -76,6 +80,7 @@ gen_uint!(gen_u64_chacha20, u64, ChaChaRng::from_entropy());
gen_uint!(gen_u64_hc128, u64, Hc128Rng::from_entropy());
gen_uint!(gen_u64_isaac, u64, IsaacRng::from_entropy());
gen_uint!(gen_u64_isaac64, u64, Isaac64Rng::from_entropy());
gen_uint!(gen_u64_sip, u64, SipRng::from_entropy());
gen_uint!(gen_u64_std, u64, StdRng::from_entropy());
gen_uint!(gen_u64_small, u64, SmallRng::from_entropy());
gen_uint!(gen_u64_os, u64, OsRng::new().unwrap());
Expand Down Expand Up @@ -108,6 +113,7 @@ init_gen!(init_xorshift, XorShiftRng);
init_gen!(init_hc128, Hc128Rng);
init_gen!(init_isaac, IsaacRng);
init_gen!(init_isaac64, Isaac64Rng);
init_gen!(init_sip, SipRng);
init_gen!(init_chacha, ChaChaRng);

#[bench]
Expand Down

0 comments on commit 7b7dc79

Please sign in to comment.