Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch backup entropy generator to JitterRng #196

Merged
merged 4 commits into from
Dec 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ matrix:
- rust: beta
- rust: nightly
script:
- cargo bench
- cargo test
- cargo test --features nightly
- cargo test --manifest-path rand-derive/Cargo.toml
Expand Down
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ install:
build: false

test_script:
- cargo bench
- cargo test
- cargo test --features nightly
- cargo test --manifest-path rand-derive/Cargo.toml
11 changes: 10 additions & 1 deletion benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,18 @@ mod distributions;

use std::mem::size_of;
use test::{black_box, Bencher};
use rand::{XorShiftRng, StdRng, IsaacRng, Isaac64Rng, Rng};
use rand::{XorShiftRng, StdRng, IsaacRng, Isaac64Rng, JitterRng, Rng};
use rand::{OsRng, sample, weak_rng};

#[bench]
fn rand_jitter(b: &mut Bencher) {
let mut rng = JitterRng::new().unwrap();
b.iter(|| {
black_box(rng.next_u64());
});
b.bytes = size_of::<u64>() as u64;
}

#[bench]
fn rand_xorshift(b: &mut Bencher) {
let mut rng: XorShiftRng = OsRng::new().unwrap().gen();
Expand Down
Loading