From ad265c5cd746c2b3347d88d028acd3db639666ed Mon Sep 17 00:00:00 2001 From: JP-Ellis Date: Sun, 17 Jun 2018 19:09:22 +1000 Subject: [PATCH] Fix benchmarks Signed-off-by: JP-Ellis --- src/statistic.rs | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/statistic.rs b/src/statistic.rs index bf23083d45..cfadfa8d09 100644 --- a/src/statistic.rs +++ b/src/statistic.rs @@ -311,6 +311,7 @@ mod bench { use csv; use test::{black_box, Bencher}; + type Row6 = (f64, f64, f64, f64, f64, f64); type Row7 = (f64, f64, f64, f64, f64, f64, f64); const STEP_SIZE: usize = 10; @@ -386,14 +387,14 @@ mod bench { #[bench] fn fermi_dirac_massless(b: &mut Bencher) { let fd = Statistic::FermiDirac; - let rdr = csv::Reader::from_path("test/data/number_density_massive.csv").unwrap(); - let data: Vec = rdr.into_deserialize() + let rdr = csv::Reader::from_path("test/data/number_density_massless.csv").unwrap(); + let data: Vec = rdr.into_deserialize() .step_by(STEP_SIZE) .map(|r| r.unwrap()) .collect(); b.iter(|| { - for &(_, mu, beta, _, _, _, _) in &data { + for &(mu, beta, _, _, _, _) in &data { let n = fd.massless_number_density(mu, beta); black_box(n); } @@ -403,14 +404,14 @@ mod bench { #[bench] fn bose_einstein_massless(b: &mut Bencher) { let be = Statistic::BoseEinstein; - let rdr = csv::Reader::from_path("test/data/number_density_massive.csv").unwrap(); - let data: Vec = rdr.into_deserialize() + let rdr = csv::Reader::from_path("test/data/number_density_massless.csv").unwrap(); + let data: Vec = rdr.into_deserialize() .step_by(STEP_SIZE) .map(|r| r.unwrap()) .collect(); b.iter(|| { - for &(_, mu, beta, _, _, _, _) in &data { + for &(mu, beta, _, _, _, _) in &data { let n = be.massless_number_density(mu, beta); black_box(n); } @@ -420,14 +421,14 @@ mod bench { #[bench] fn maxwell_boltzmann_massless(b: &mut Bencher) { let mb = Statistic::MaxwellBoltzmann; - let rdr = csv::Reader::from_path("test/data/number_density_massive.csv").unwrap(); - let data: Vec = rdr.into_deserialize() + let rdr = csv::Reader::from_path("test/data/number_density_massless.csv").unwrap(); + let data: Vec = rdr.into_deserialize() .step_by(STEP_SIZE) .map(|r| r.unwrap()) .collect(); b.iter(|| { - for &(_, mu, beta, _, _, _, _) in &data { + for &(mu, beta, _, _, _, _) in &data { let n = mb.massless_number_density(mu, beta); black_box(n); } @@ -437,14 +438,14 @@ mod bench { #[bench] fn maxwell_juttner_massless(b: &mut Bencher) { let mj = Statistic::MaxwellJuttner; - let rdr = csv::Reader::from_path("test/data/number_density_massive.csv").unwrap(); - let data: Vec = rdr.into_deserialize() + let rdr = csv::Reader::from_path("test/data/number_density_massless.csv").unwrap(); + let data: Vec = rdr.into_deserialize() .step_by(STEP_SIZE) .map(|r| r.unwrap()) .collect(); b.iter(|| { - for &(_, mu, beta, _, _, _, _) in &data { + for &(mu, beta, _, _, _, _) in &data { let n = mj.massless_number_density(mu, beta); black_box(n); }