Clean up benchmarks

This commit is contained in:
Vinzent Steinberg 2019-07-08 16:08:53 +02:00
parent 9401f41558
commit 0890aee3fb
3 changed files with 8 additions and 28 deletions

View File

@ -1,18 +1,12 @@
#![cfg_attr(feature = "cargo-clippy", allow(float_cmp, map_clone))] #![cfg_attr(feature = "cargo-clippy", allow(float_cmp, map_clone))]
#[macro_use] extern crate bencher; use bencher::{Bencher, benchmark_group, benchmark_main};
use rand_xoshiro;
use average;
use bencher::Bencher;
/// Create a random vector by sampling from a normal distribution. /// Create a random vector by sampling from a normal distribution.
fn initialize_vec() -> Vec<f64> { fn initialize_vec() -> Vec<f64> {
use rand::distributions::{Normal, Distribution}; use rand_distr::{Normal, Distribution};
use rand::SeedableRng; use rand::SeedableRng;
let normal = Normal::new(2.0, 3.0); let normal = Normal::new(2.0, 3.0).unwrap();
let n = 1_000_000; let n = 1_000_000;
let mut values = Vec::with_capacity(n); let mut values = Vec::with_capacity(n);
let mut rng = rand_xoshiro::Xoshiro256StarStar::from_seed( let mut rng = rand_xoshiro::Xoshiro256StarStar::from_seed(

View File

@ -1,19 +1,12 @@
#![cfg_attr(feature = "cargo-clippy", allow(float_cmp, map_clone))] #![cfg_attr(feature = "cargo-clippy", allow(float_cmp, map_clone))]
#[macro_use] extern crate bencher; use bencher::{Bencher, benchmark_group, benchmark_main};
use rand_xoshiro;
use average;
use stats;
use bencher::Bencher;
/// Create a random vector by sampling from a normal distribution. /// Create a random vector by sampling from a normal distribution.
fn initialize_vec() -> Vec<f64> { fn initialize_vec() -> Vec<f64> {
use rand::distributions::{Normal, Distribution}; use rand_distr::{Normal, Distribution};
use rand::SeedableRng; use rand::SeedableRng;
let normal = Normal::new(2.0, 3.0); let normal = Normal::new(2.0, 3.0).unwrap();
let n = 1_000_000; let n = 1_000_000;
let mut values = Vec::with_capacity(n); let mut values = Vec::with_capacity(n);
let mut rng = rand_xoshiro::Xoshiro256StarStar::from_seed( let mut rng = rand_xoshiro::Xoshiro256StarStar::from_seed(

View File

@ -1,17 +1,10 @@
#![cfg_attr(feature = "cargo-clippy", allow(float_cmp, map_clone))] #![cfg_attr(feature = "cargo-clippy", allow(float_cmp, map_clone))]
#[macro_use] extern crate bencher; use bencher::{Bencher, benchmark_group, benchmark_main};
use rand_xoshiro;
use average;
use bencher::Bencher;
/// Create a random vector of random floats in [0, 1]. /// Create a random vector of random floats in [0, 1].
fn initialize_vec() -> Vec<f64> { fn initialize_vec() -> Vec<f64> {
use rand::distributions::{Uniform, Distribution}; use rand_distr::{Uniform, Distribution};
use rand::SeedableRng; use rand::SeedableRng;
let range = Uniform::new(0.0, 1.0); let range = Uniform::new(0.0, 1.0);
let n = 1_000_000; let n = 1_000_000;