11// NOTE: This file was taken from `codspeed-rust` and modified a bit to fit this project.
22
33use anyhow:: Result ;
4- use rayon:: prelude:: * ;
54use serde:: { Deserialize , Serialize } ;
65use statrs:: statistics:: { Data , Distribution , Max , Min , OrderStatistics } ;
76
@@ -58,13 +57,10 @@ impl WalltimeBenchmark {
5857 times_per_round_ns : & [ u64 ] ,
5958 max_time_ns : Option < u128 > ,
6059 ) -> Self {
61- let total_time = times_per_round_ns
62- . par_iter ( )
63- . map ( |& t| t as u128 )
64- . sum :: < u128 > ( ) as f64
65- / 1_000_000_000.0 ;
60+ let total_time =
61+ times_per_round_ns. iter ( ) . map ( |& t| t as u128 ) . sum :: < u128 > ( ) as f64 / 1_000_000_000.0 ;
6662 let time_per_iteration_per_round_ns: Vec < _ > = times_per_round_ns
67- . par_iter ( )
63+ . iter ( )
6864 . zip ( iters_per_round)
6965 . map ( |( time_per_round, iter_per_round) | {
7066 * time_per_round as u128 / * iter_per_round as u128
@@ -92,15 +88,13 @@ impl WalltimeBenchmark {
9288 let iqr_ns = q3_ns - q1_ns;
9389 let iqr_outlier_rounds = data
9490 . iter ( )
95- . par_bridge ( )
9691 . filter ( |& & t| {
9792 t < q1_ns - IQR_OUTLIER_FACTOR * iqr_ns || t > q3_ns + IQR_OUTLIER_FACTOR * iqr_ns
9893 } )
9994 . count ( ) as u64 ;
10095
10196 let stdev_outlier_rounds = data
10297 . iter ( )
103- . par_bridge ( )
10498 . filter ( |& & t| {
10599 t < mean_ns - STDEV_OUTLIER_FACTOR * stdev_ns
106100 || t > mean_ns + STDEV_OUTLIER_FACTOR * stdev_ns
@@ -111,7 +105,7 @@ impl WalltimeBenchmark {
111105 let max_ns = data. max ( ) ;
112106
113107 // TODO(COD-1056): We currently only support single iteration count per round
114- let iter_per_round = ( iters_per_round. par_iter ( ) . map ( |& t| t as u128 ) . sum :: < u128 > ( )
108+ let iter_per_round = ( iters_per_round. iter ( ) . map ( |& t| t as u128 ) . sum :: < u128 > ( )
115109 / iters_per_round. len ( ) as u128 ) as u64 ;
116110 let warmup_iters = 0 ; // FIXME: add warmup detection
117111
0 commit comments