@@ -111,7 +111,7 @@ pub async fn handle_compare(
111
111
let benchmark_map = conn. get_benchmarks ( ) . await ;
112
112
113
113
let comparisons = comparison
114
- . statistics
114
+ . comparisons
115
115
. into_iter ( )
116
116
. map ( |comparison| api:: comparison:: Comparison {
117
117
benchmark : comparison. benchmark . to_string ( ) ,
@@ -145,7 +145,7 @@ pub async fn handle_compare(
145
145
146
146
async fn populate_report (
147
147
ctxt : & SiteCtxt ,
148
- comparison : & Comparison ,
148
+ comparison : & ArtifactComparison ,
149
149
report : & mut HashMap < Direction , Vec < String > > ,
150
150
) {
151
151
let benchmark_map = ctxt. get_benchmark_category_map ( ) . await ;
@@ -177,7 +177,7 @@ async fn populate_report(
177
177
/// A summary of a given comparison
178
178
///
179
179
/// This summary only includes changes that are significant and relevant (as determined by a change's magnitude).
180
- pub struct ComparisonSummary {
180
+ pub struct ArtifactComparisonSummary {
181
181
/// Relevant comparisons ordered by magnitude from largest to smallest
182
182
relevant_comparisons : Vec < TestResultComparison > ,
183
183
/// The cached number of comparisons that are improvements
@@ -186,13 +186,13 @@ pub struct ComparisonSummary {
186
186
num_regressions : usize ,
187
187
}
188
188
189
- impl ComparisonSummary {
190
- pub fn summarize_comparison ( comparison : & Comparison ) -> Self {
189
+ impl ArtifactComparisonSummary {
190
+ pub fn summarize ( comparison : & ArtifactComparison ) -> Self {
191
191
let mut num_improvements = 0 ;
192
192
let mut num_regressions = 0 ;
193
193
194
194
let mut comparisons = comparison
195
- . statistics
195
+ . comparisons
196
196
. iter ( )
197
197
. filter ( |c| c. is_relevant ( ) )
198
198
. inspect ( |c| {
@@ -213,7 +213,7 @@ impl ComparisonSummary {
213
213
} ;
214
214
comparisons. sort_by ( cmp) ;
215
215
216
- ComparisonSummary {
216
+ ArtifactComparisonSummary {
217
217
relevant_comparisons : comparisons,
218
218
num_improvements,
219
219
num_regressions,
@@ -334,14 +334,6 @@ impl ComparisonSummary {
334
334
. filter ( |c| c. is_regression ( ) )
335
335
}
336
336
337
- fn num_changes ( & self ) -> usize {
338
- self . relevant_comparisons . len ( )
339
- }
340
-
341
- fn largest_change ( & self ) -> Option < & TestResultComparison > {
342
- self . relevant_comparisons . first ( )
343
- }
344
-
345
337
fn largest_improvement ( & self ) -> Option < & TestResultComparison > {
346
338
self . relevant_comparisons
347
339
. iter ( )
@@ -367,9 +359,9 @@ impl ComparisonSummary {
367
359
}
368
360
369
361
async fn write_triage_summary (
370
- comparison : & Comparison ,
371
- primary : & ComparisonSummary ,
372
- secondary : & ComparisonSummary ,
362
+ comparison : & ArtifactComparison ,
363
+ primary : & ArtifactComparisonSummary ,
364
+ secondary : & ArtifactComparisonSummary ,
373
365
) -> String {
374
366
use std:: fmt:: Write ;
375
367
let mut result = if let Some ( pr) = comparison. b . pr {
@@ -393,8 +385,8 @@ async fn write_triage_summary(
393
385
394
386
/// Writes a Markdown table containing summary of relevant results.
395
387
pub fn write_summary_table (
396
- primary : & ComparisonSummary ,
397
- secondary : & ComparisonSummary ,
388
+ primary : & ArtifactComparisonSummary ,
389
+ secondary : & ArtifactComparisonSummary ,
398
390
with_footnotes : bool ,
399
391
result : & mut String ,
400
392
) {
@@ -512,7 +504,7 @@ pub async fn compare(
512
504
end : Bound ,
513
505
stat : String ,
514
506
ctxt : & SiteCtxt ,
515
- ) -> Result < Option < Comparison > , BoxedError > {
507
+ ) -> Result < Option < ArtifactComparison > , BoxedError > {
516
508
let master_commits = & ctxt. get_master_commits ( ) . commits ;
517
509
518
510
compare_given_commits ( start, end, stat, ctxt, master_commits) . await
@@ -525,7 +517,7 @@ async fn compare_given_commits(
525
517
stat : String ,
526
518
ctxt : & SiteCtxt ,
527
519
master_commits : & [ collector:: MasterCommit ] ,
528
- ) -> Result < Option < Comparison > , BoxedError > {
520
+ ) -> Result < Option < ArtifactComparison > , BoxedError > {
529
521
let idx = ctxt. index . load ( ) ;
530
522
let a = ctxt
531
523
. artifact_id_for_bound ( start. clone ( ) , true )
@@ -553,7 +545,7 @@ async fn compare_given_commits(
553
545
554
546
let mut historical_data =
555
547
HistoricalDataMap :: calculate ( ctxt, a. clone ( ) , master_commits, stat) . await ?;
556
- let statistics = statistics_for_a
548
+ let comparisons = statistics_for_a
557
549
. into_iter ( )
558
550
. filter_map ( |( test_case, a) | {
559
551
statistics_for_b
@@ -574,10 +566,10 @@ async fn compare_given_commits(
574
566
errors_in_b. remove ( & name) ;
575
567
}
576
568
577
- Ok ( Some ( Comparison {
569
+ Ok ( Some ( ArtifactComparison {
578
570
a : ArtifactDescription :: for_artifact ( & * conn, a. clone ( ) , master_commits) . await ,
579
571
b : ArtifactDescription :: for_artifact ( & * conn, b. clone ( ) , master_commits) . await ,
580
- statistics ,
572
+ comparisons ,
581
573
newly_failed_benchmarks : errors_in_b. into_iter ( ) . collect ( ) ,
582
574
} ) )
583
575
}
@@ -720,16 +712,16 @@ impl From<ArtifactDescription> for api::comparison::ArtifactDescription {
720
712
721
713
// A comparison of two artifacts
722
714
#[ derive( Clone ) ]
723
- pub struct Comparison {
715
+ pub struct ArtifactComparison {
724
716
pub a : ArtifactDescription ,
725
717
pub b : ArtifactDescription ,
726
- /// Statistics based on test case
727
- pub statistics : HashSet < TestResultComparison > ,
718
+ /// Test result comparisons between the two artifacts
719
+ pub comparisons : HashSet < TestResultComparison > ,
728
720
/// A map from benchmark name to an error which occured when building `b` but not `a`.
729
721
pub newly_failed_benchmarks : HashMap < String , String > ,
730
722
}
731
723
732
- impl Comparison {
724
+ impl ArtifactComparison {
733
725
/// Gets the previous commit before `a`
734
726
pub fn prev ( & self , master_commits : & [ collector:: MasterCommit ] ) -> Option < String > {
735
727
prev_commit ( & self . a . artifact , master_commits) . map ( |c| c. sha . clone ( ) )
@@ -758,13 +750,13 @@ impl Comparison {
758
750
next_commit ( & self . b . artifact , master_commits) . map ( |c| c. sha . clone ( ) )
759
751
}
760
752
761
- /// Splits comparison into primary and secondary summaries based on benchmark category
753
+ /// Splits an artifact comparison into primary and secondary summaries based on benchmark category
762
754
pub fn summarize_by_category (
763
755
self ,
764
756
category_map : HashMap < Benchmark , Category > ,
765
- ) -> ( ComparisonSummary , ComparisonSummary ) {
757
+ ) -> ( ArtifactComparisonSummary , ArtifactComparisonSummary ) {
766
758
let ( primary, secondary) = self
767
- . statistics
759
+ . comparisons
768
760
. into_iter ( )
769
761
. partition ( |s| category_map. get ( & s. benchmark ( ) ) == Some ( & Category :: Primary ) ) ;
770
762
@@ -773,21 +765,21 @@ impl Comparison {
773
765
. into_iter ( )
774
766
. partition ( |( b, _) | category_map. get ( & b. as_str ( ) . into ( ) ) == Some ( & Category :: Primary ) ) ;
775
767
776
- let primary = Comparison {
768
+ let primary = ArtifactComparison {
777
769
a : self . a . clone ( ) ,
778
770
b : self . b . clone ( ) ,
779
- statistics : primary,
771
+ comparisons : primary,
780
772
newly_failed_benchmarks : primary_errors,
781
773
} ;
782
- let secondary = Comparison {
774
+ let secondary = ArtifactComparison {
783
775
a : self . a ,
784
776
b : self . b ,
785
- statistics : secondary,
777
+ comparisons : secondary,
786
778
newly_failed_benchmarks : secondary_errors,
787
779
} ;
788
780
(
789
- ComparisonSummary :: summarize_comparison ( & primary) ,
790
- ComparisonSummary :: summarize_comparison ( & secondary) ,
781
+ ArtifactComparisonSummary :: summarize ( & primary) ,
782
+ ArtifactComparisonSummary :: summarize ( & secondary) ,
791
783
)
792
784
}
793
785
}
@@ -1166,7 +1158,7 @@ Triage done by **@???**.
1166
1158
Revision range: [{first_commit}..{last_commit}](https://perf.rust-lang.org/?start={first_commit}&end={last_commit}&absolute=false&stat=instructions%3Au)
1167
1159
1168
1160
{num_regressions} Regressions, {num_improvements} Improvements, {num_mixed} Mixed; ??? of them in rollups
1169
- {num_comparisons} comparisons made in total
1161
+ {num_comparisons} artifact comparisons made in total
1170
1162
1171
1163
#### Regressions
1172
1164
@@ -1407,13 +1399,13 @@ mod tests {
1407
1399
1408
1400
// (category, before, after)
1409
1401
fn check_table ( values : Vec < ( Category , f64 , f64 ) > , expected : & str ) {
1410
- let mut primary_statistics = HashSet :: new ( ) ;
1411
- let mut secondary_statistics = HashSet :: new ( ) ;
1402
+ let mut primary_comparisons = HashSet :: new ( ) ;
1403
+ let mut secondary_comparisons = HashSet :: new ( ) ;
1412
1404
for ( index, ( category, before, after) ) in values. into_iter ( ) . enumerate ( ) {
1413
1405
let target = if category == Category :: Primary {
1414
- & mut primary_statistics
1406
+ & mut primary_comparisons
1415
1407
} else {
1416
- & mut secondary_statistics
1408
+ & mut secondary_comparisons
1417
1409
} ;
1418
1410
1419
1411
target. insert ( TestResultComparison {
@@ -1425,16 +1417,16 @@ mod tests {
1425
1417
} ) ;
1426
1418
}
1427
1419
1428
- let primary = create_summary ( primary_statistics ) ;
1429
- let secondary = create_summary ( secondary_statistics ) ;
1420
+ let primary = create_summary ( primary_comparisons ) ;
1421
+ let secondary = create_summary ( secondary_comparisons ) ;
1430
1422
1431
1423
let mut result = String :: new ( ) ;
1432
1424
write_summary_table ( & primary, & secondary, true , & mut result) ;
1433
1425
assert_eq ! ( result, expected) ;
1434
1426
}
1435
1427
1436
- fn create_summary ( statistics : HashSet < TestResultComparison > ) -> ComparisonSummary {
1437
- let comparison = Comparison {
1428
+ fn create_summary ( comparisons : HashSet < TestResultComparison > ) -> ArtifactComparisonSummary {
1429
+ let comparison = ArtifactComparison {
1438
1430
a : ArtifactDescription {
1439
1431
artifact : ArtifactId :: Tag ( "a" . to_string ( ) ) ,
1440
1432
pr : None ,
@@ -1447,9 +1439,9 @@ mod tests {
1447
1439
bootstrap : Default :: default ( ) ,
1448
1440
bootstrap_total : 0 ,
1449
1441
} ,
1450
- statistics ,
1442
+ comparisons ,
1451
1443
newly_failed_benchmarks : Default :: default ( ) ,
1452
1444
} ;
1453
- ComparisonSummary :: summarize_comparison ( & comparison)
1445
+ ArtifactComparisonSummary :: summarize ( & comparison)
1454
1446
}
1455
1447
}
0 commit comments