std::rand: lengthen the RNG benchmarks.
This makes them more representative, as the `bh.iter` is a smaller percentage of the total time.
This commit is contained in:
parent
ed5f2d7c7c
commit
83aa1abb19
|
@ -970,41 +970,53 @@ mod bench {
|
|||
use extra::test::BenchHarness;
|
||||
use rand::*;
|
||||
use mem::size_of;
|
||||
use iter::range;
|
||||
use option::{Some, None};
|
||||
|
||||
static N: u64 = 100;
|
||||
|
||||
#[bench]
|
||||
fn rand_xorshift(bh: &mut BenchHarness) {
|
||||
let mut rng = XorShiftRng::new();
|
||||
do bh.iter {
|
||||
rng.gen::<uint>();
|
||||
for _ in range(0, N) {
|
||||
rng.gen::<uint>();
|
||||
}
|
||||
}
|
||||
bh.bytes = size_of::<uint>() as u64;
|
||||
bh.bytes = size_of::<uint>() as u64 * N;
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn rand_isaac(bh: &mut BenchHarness) {
|
||||
let mut rng = IsaacRng::new();
|
||||
do bh.iter {
|
||||
rng.gen::<uint>();
|
||||
for _ in range(0, N) {
|
||||
rng.gen::<uint>();
|
||||
}
|
||||
}
|
||||
bh.bytes = size_of::<uint>() as u64;
|
||||
bh.bytes = size_of::<uint>() as u64 * N;
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn rand_isaac64(bh: &mut BenchHarness) {
|
||||
let mut rng = Isaac64Rng::new();
|
||||
do bh.iter {
|
||||
rng.gen::<uint>();
|
||||
for _ in range(0, N) {
|
||||
rng.gen::<uint>();
|
||||
}
|
||||
}
|
||||
bh.bytes = size_of::<uint>() as u64;
|
||||
bh.bytes = size_of::<uint>() as u64 * N;
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn rand_std(bh: &mut BenchHarness) {
|
||||
let mut rng = StdRng::new();
|
||||
do bh.iter {
|
||||
rng.gen::<uint>();
|
||||
for _ in range(0, N) {
|
||||
rng.gen::<uint>();
|
||||
}
|
||||
}
|
||||
bh.bytes = size_of::<uint>() as u64;
|
||||
bh.bytes = size_of::<uint>() as u64 * N;
|
||||
}
|
||||
|
||||
#[bench]
|
||||
|
|
Loading…
Reference in New Issue