Skip to content

Commit 2fc64ed

Browse files
committed
Remove old RNG crates from benchmarks
Note: the init benches now use a different master RNG; this appears to have little affect on results.
1 parent 3f2ab75 commit 2fc64ed

File tree

3 files changed

+1
-56
lines changed

3 files changed

+1
-56
lines changed

benches/generators.rs

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,9 @@ use test::{black_box, Bencher};
2020
use rand::prelude::*;
2121
use rand::rngs::adapter::ReseedingRng;
2222
use rand::rngs::{OsRng, mock::StepRng};
23-
use rand_isaac::{IsaacRng, Isaac64Rng};
2423
use rand_chacha::{ChaCha20Core, ChaCha8Rng, ChaCha12Rng, ChaCha20Rng};
2524
use rand_hc::{Hc128Rng};
2625
use rand_pcg::{Pcg32, Pcg64, Pcg64Mcg};
27-
use rand_xorshift::XorShiftRng;
28-
use rand_xoshiro::{Xoshiro256StarStar, Xoshiro256Plus, Xoshiro128StarStar,
29-
Xoshiro128Plus, Xoroshiro128StarStar, Xoroshiro128Plus, SplitMix64,
30-
Xoroshiro64StarStar, Xoroshiro64Star};
3126

3227
macro_rules! gen_bytes {
3328
($fnn:ident, $gen:expr) => {
@@ -47,25 +42,13 @@ macro_rules! gen_bytes {
4742
}
4843

4944
gen_bytes!(gen_bytes_step, StepRng::new(0, 1));
50-
gen_bytes!(gen_bytes_xorshift, XorShiftRng::from_entropy());
51-
gen_bytes!(gen_bytes_xoshiro256starstar, Xoshiro256StarStar::from_entropy());
52-
gen_bytes!(gen_bytes_xoshiro256plus, Xoshiro256Plus::from_entropy());
53-
gen_bytes!(gen_bytes_xoshiro128starstar, Xoshiro128StarStar::from_entropy());
54-
gen_bytes!(gen_bytes_xoshiro128plus, Xoshiro128Plus::from_entropy());
55-
gen_bytes!(gen_bytes_xoroshiro128starstar, Xoroshiro128StarStar::from_entropy());
56-
gen_bytes!(gen_bytes_xoroshiro128plus, Xoroshiro128Plus::from_entropy());
57-
gen_bytes!(gen_bytes_xoroshiro64starstar, Xoroshiro64StarStar::from_entropy());
58-
gen_bytes!(gen_bytes_xoroshiro64star, Xoroshiro64Star::from_entropy());
59-
gen_bytes!(gen_bytes_splitmix64, SplitMix64::from_entropy());
6045
gen_bytes!(gen_bytes_pcg32, Pcg32::from_entropy());
6146
gen_bytes!(gen_bytes_pcg64, Pcg64::from_entropy());
6247
gen_bytes!(gen_bytes_pcg64mcg, Pcg64Mcg::from_entropy());
6348
gen_bytes!(gen_bytes_chacha8, ChaCha8Rng::from_entropy());
6449
gen_bytes!(gen_bytes_chacha12, ChaCha12Rng::from_entropy());
6550
gen_bytes!(gen_bytes_chacha20, ChaCha20Rng::from_entropy());
6651
gen_bytes!(gen_bytes_hc128, Hc128Rng::from_entropy());
67-
gen_bytes!(gen_bytes_isaac, IsaacRng::from_entropy());
68-
gen_bytes!(gen_bytes_isaac64, Isaac64Rng::from_entropy());
6952
gen_bytes!(gen_bytes_std, StdRng::from_entropy());
7053
#[cfg(feature="small_rng")]
7154
gen_bytes!(gen_bytes_small, SmallRng::from_entropy());
@@ -89,50 +72,26 @@ macro_rules! gen_uint {
8972
}
9073

9174
gen_uint!(gen_u32_step, u32, StepRng::new(0, 1));
92-
gen_uint!(gen_u32_xorshift, u32, XorShiftRng::from_entropy());
93-
gen_uint!(gen_u32_xoshiro256starstar, u32, Xoshiro256StarStar::from_entropy());
94-
gen_uint!(gen_u32_xoshiro256plus, u32, Xoshiro256Plus::from_entropy());
95-
gen_uint!(gen_u32_xoshiro128starstar, u32, Xoshiro128StarStar::from_entropy());
96-
gen_uint!(gen_u32_xoshiro128plus, u32, Xoshiro128Plus::from_entropy());
97-
gen_uint!(gen_u32_xoroshiro128starstar, u32, Xoroshiro128StarStar::from_entropy());
98-
gen_uint!(gen_u32_xoroshiro128plus, u32, Xoroshiro128Plus::from_entropy());
99-
gen_uint!(gen_u32_xoroshiro64starstar, u32, Xoroshiro64StarStar::from_entropy());
100-
gen_uint!(gen_u32_xoroshiro64star, u32, Xoroshiro64Star::from_entropy());
101-
gen_uint!(gen_u32_splitmix64, u32, SplitMix64::from_entropy());
10275
gen_uint!(gen_u32_pcg32, u32, Pcg32::from_entropy());
10376
gen_uint!(gen_u32_pcg64, u32, Pcg64::from_entropy());
10477
gen_uint!(gen_u32_pcg64mcg, u32, Pcg64Mcg::from_entropy());
10578
gen_uint!(gen_u32_chacha8, u32, ChaCha8Rng::from_entropy());
10679
gen_uint!(gen_u32_chacha12, u32, ChaCha12Rng::from_entropy());
10780
gen_uint!(gen_u32_chacha20, u32, ChaCha20Rng::from_entropy());
10881
gen_uint!(gen_u32_hc128, u32, Hc128Rng::from_entropy());
109-
gen_uint!(gen_u32_isaac, u32, IsaacRng::from_entropy());
110-
gen_uint!(gen_u32_isaac64, u32, Isaac64Rng::from_entropy());
11182
gen_uint!(gen_u32_std, u32, StdRng::from_entropy());
11283
#[cfg(feature="small_rng")]
11384
gen_uint!(gen_u32_small, u32, SmallRng::from_entropy());
11485
gen_uint!(gen_u32_os, u32, OsRng);
11586

11687
gen_uint!(gen_u64_step, u64, StepRng::new(0, 1));
117-
gen_uint!(gen_u64_xorshift, u64, XorShiftRng::from_entropy());
118-
gen_uint!(gen_u64_xoshiro256starstar, u64, Xoshiro256StarStar::from_entropy());
119-
gen_uint!(gen_u64_xoshiro256plus, u64, Xoshiro256Plus::from_entropy());
120-
gen_uint!(gen_u64_xoshiro128starstar, u64, Xoshiro128StarStar::from_entropy());
121-
gen_uint!(gen_u64_xoshiro128plus, u64, Xoshiro128Plus::from_entropy());
122-
gen_uint!(gen_u64_xoroshiro128starstar, u64, Xoroshiro128StarStar::from_entropy());
123-
gen_uint!(gen_u64_xoroshiro128plus, u64, Xoroshiro128Plus::from_entropy());
124-
gen_uint!(gen_u64_xoroshiro64starstar, u64, Xoroshiro64StarStar::from_entropy());
125-
gen_uint!(gen_u64_xoroshiro64star, u64, Xoroshiro64Star::from_entropy());
126-
gen_uint!(gen_u64_splitmix64, u64, SplitMix64::from_entropy());
12788
gen_uint!(gen_u64_pcg32, u64, Pcg32::from_entropy());
12889
gen_uint!(gen_u64_pcg64, u64, Pcg64::from_entropy());
12990
gen_uint!(gen_u64_pcg64mcg, u64, Pcg64Mcg::from_entropy());
13091
gen_uint!(gen_u64_chacha8, u64, ChaCha8Rng::from_entropy());
13192
gen_uint!(gen_u64_chacha12, u64, ChaCha12Rng::from_entropy());
13293
gen_uint!(gen_u64_chacha20, u64, ChaCha20Rng::from_entropy());
13394
gen_uint!(gen_u64_hc128, u64, Hc128Rng::from_entropy());
134-
gen_uint!(gen_u64_isaac, u64, IsaacRng::from_entropy());
135-
gen_uint!(gen_u64_isaac64, u64, Isaac64Rng::from_entropy());
13695
gen_uint!(gen_u64_std, u64, StdRng::from_entropy());
13796
#[cfg(feature="small_rng")]
13897
gen_uint!(gen_u64_small, u64, SmallRng::from_entropy());
@@ -142,7 +101,7 @@ macro_rules! init_gen {
142101
($fnn:ident, $gen:ident) => {
143102
#[bench]
144103
fn $fnn(b: &mut Bencher) {
145-
let mut rng = XorShiftRng::from_entropy();
104+
let mut rng = Pcg32::from_entropy();
146105
b.iter(|| {
147106
let r2 = $gen::from_rng(&mut rng).unwrap();
148107
r2
@@ -151,22 +110,10 @@ macro_rules! init_gen {
151110
}
152111
}
153112

154-
init_gen!(init_xorshift, XorShiftRng);
155-
init_gen!(init_xoshiro256starstar, Xoshiro256StarStar);
156-
init_gen!(init_xoshiro256plus, Xoshiro256Plus);
157-
init_gen!(init_xoshiro128starstar, Xoshiro128StarStar);
158-
init_gen!(init_xoshiro128plus, Xoshiro128Plus);
159-
init_gen!(init_xoroshiro128starstar, Xoroshiro128StarStar);
160-
init_gen!(init_xoroshiro128plus, Xoroshiro128Plus);
161-
init_gen!(init_xoroshiro64starstar, Xoroshiro64StarStar);
162-
init_gen!(init_xoroshiro64star, Xoroshiro64Star);
163-
init_gen!(init_splitmix64, SplitMix64);
164113
init_gen!(init_pcg32, Pcg32);
165114
init_gen!(init_pcg64, Pcg64);
166115
init_gen!(init_pcg64mcg, Pcg64Mcg);
167116
init_gen!(init_hc128, Hc128Rng);
168-
init_gen!(init_isaac, IsaacRng);
169-
init_gen!(init_isaac64, Isaac64Rng);
170117
init_gen!(init_chacha, ChaCha20Rng);
171118

172119
const RESEEDING_BYTES_LEN: usize = 1024 * 1024;

rand_core/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,6 @@ pub trait SeedableRng: Sized {
353353
/// (in prior versions this was not required).
354354
///
355355
/// [`rand`]: https://docs.rs/rand
356-
/// [`rand_os`]: https://docs.rs/rand_os
357356
fn from_rng<R: RngCore>(mut rng: R) -> Result<Self, Error> {
358357
let mut seed = Self::Seed::default();
359358
rng.try_fill_bytes(seed.as_mut())?;

rand_core/src/os.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
// except according to those terms.
88

99
//! Interface to the random number generator of the operating system.
10-
// Note: keep this code in sync with the rand_os crate!
1110
1211
use getrandom::getrandom;
1312
use crate::{CryptoRng, RngCore, Error, impls};

0 commit comments

Comments
 (0)