@@ -293,7 +293,7 @@ pub struct ArtifactData {
293
293
pub bootstrap : HashMap < String , u64 > ,
294
294
}
295
295
296
- type StatisticsMap = HashMap < Benchmark , HashMap < Profile , Vec < ( Scenario , f64 ) > > > ;
296
+ type StatisticsMap = HashMap < ( Benchmark , Profile , Scenario ) , f64 > ;
297
297
298
298
impl ArtifactData {
299
299
/// For the given `ArtifactId`, consume the first datapoint in each of the given `SeriesResponse`
@@ -367,33 +367,20 @@ where
367
367
let benchmark = * response. path . get :: < Benchmark > ( ) . unwrap ( ) ;
368
368
let profile = * response. path . get :: < Profile > ( ) . unwrap ( ) ;
369
369
let scenario = * response. path . get :: < Scenario > ( ) . unwrap ( ) ;
370
- stats
371
- . entry ( benchmark)
372
- . or_default ( )
373
- . entry ( profile)
374
- . or_default ( )
375
- . push ( ( scenario, value) ) ;
370
+ stats. insert ( ( benchmark, profile, scenario) , value) ;
376
371
}
377
372
stats
378
373
}
379
374
380
375
impl From < ArtifactData > for api:: comparison:: ArtifactData {
381
376
fn from ( data : ArtifactData ) -> Self {
382
- let stats = data
383
- . statistics
384
- . into_iter ( )
385
- . flat_map ( |( benchmark, profiles) | {
386
- profiles. into_iter ( ) . map ( move |( profile, scenarios) | {
387
- (
388
- format ! ( "{}-{}" , benchmark, profile) ,
389
- scenarios
390
- . into_iter ( )
391
- . map ( |( s, v) | ( s. to_string ( ) , v) )
392
- . collect :: < Vec < _ > > ( ) ,
393
- )
394
- } )
395
- } )
396
- . collect ( ) ;
377
+ let mut stats: HashMap < String , Vec < ( String , f64 ) > > = HashMap :: new ( ) ;
378
+ for ( ( benchmark, profile, scenario) , value) in data. statistics {
379
+ stats
380
+ . entry ( format ! ( "{}-{}" , benchmark, profile) )
381
+ . or_default ( )
382
+ . push ( ( scenario. to_string ( ) , value) )
383
+ }
397
384
api:: comparison:: ArtifactData {
398
385
commit : match data. artifact . clone ( ) {
399
386
ArtifactId :: Commit ( c) => c. sha ,
@@ -452,27 +439,18 @@ impl Comparison {
452
439
453
440
fn get_benchmarks ( & self ) -> Vec < BenchmarkComparison > {
454
441
let mut result = Vec :: new ( ) ;
455
- for ( & benchmark, profiles) in self . a . statistics . iter ( ) {
456
- for ( & profile, scenarios) in profiles {
457
- if profile == Profile :: Doc {
458
- continue ;
459
- }
442
+ for ( & ( benchmark, profile, scenario) , & a) in self . a . statistics . iter ( ) {
443
+ if profile == Profile :: Doc {
444
+ continue ;
445
+ }
460
446
461
- if let Some ( b) = self . b . statistics . get ( & benchmark) {
462
- if let Some ( b) = b. get ( & profile) {
463
- for & ( scenario, a) in scenarios. iter ( ) {
464
- if let Some ( b) = b. iter ( ) . find ( |( s, _) | * s == scenario) . map ( |( _, b) | b)
465
- {
466
- result. push ( BenchmarkComparison {
467
- benchmark,
468
- profile,
469
- scenario,
470
- results : ( a, * b) ,
471
- } )
472
- }
473
- }
474
- }
475
- }
447
+ if let Some ( & b) = self . b . statistics . get ( & ( benchmark, profile, scenario) ) {
448
+ result. push ( BenchmarkComparison {
449
+ benchmark,
450
+ profile,
451
+ scenario,
452
+ results : ( a, b) ,
453
+ } )
476
454
}
477
455
}
478
456
@@ -518,15 +496,11 @@ impl BenchmarkVariances {
518
496
let mut variance_data: HashMap < String , BenchmarkVariance > = HashMap :: new ( ) ;
519
497
for _ in previous_commits. iter ( ) {
520
498
let series_data = statistics_from_series ( & mut previous_commit_series) ;
521
- for ( bench, profiles) in series_data {
522
- for ( profile, scenarios) in profiles {
523
- for ( scenario, val) in scenarios {
524
- variance_data
525
- . entry ( format ! ( "{}-{}-{}" , bench, profile, scenario) )
526
- . or_default ( )
527
- . push ( val) ;
528
- }
529
- }
499
+ for ( ( bench, profile, scenario) , value) in series_data {
500
+ variance_data
501
+ . entry ( format ! ( "{}-{}-{}" , bench, profile, scenario) )
502
+ . or_default ( )
503
+ . push ( value) ;
530
504
}
531
505
}
532
506
if variance_data. len ( ) < Self :: MIN_PREVIOUS_COMMITS {
0 commit comments