@@ -45,6 +45,7 @@ pub async fn handle_triage(
45
45
"instructions:u" . to_owned ( ) ,
46
46
ctxt,
47
47
& master_commits,
48
+ body. calcNewSig . unwrap_or ( false ) ,
48
49
)
49
50
. await ?
50
51
{
@@ -89,10 +90,16 @@ pub async fn handle_compare(
89
90
) -> Result < api:: comparison:: Response , BoxedError > {
90
91
let master_commits = collector:: master_commits ( ) . await ?;
91
92
let end = body. end ;
92
- let comparison =
93
- compare_given_commits ( body. start , end. clone ( ) , body. stat , ctxt, & master_commits)
94
- . await ?
95
- . ok_or_else ( || format ! ( "could not find end commit for bound {:?}" , end) ) ?;
93
+ let comparison = compare_given_commits (
94
+ body. start ,
95
+ end. clone ( ) ,
96
+ body. stat ,
97
+ ctxt,
98
+ & master_commits,
99
+ body. calcNewSig . unwrap_or ( false ) ,
100
+ )
101
+ . await ?
102
+ . ok_or_else ( || format ! ( "could not find end commit for bound {:?}" , end) ) ?;
96
103
97
104
let conn = ctxt. conn ( ) . await ;
98
105
let prev = comparison. prev ( & master_commits) ;
@@ -338,7 +345,7 @@ pub async fn compare(
338
345
ctxt : & SiteCtxt ,
339
346
) -> Result < Option < Comparison > , BoxedError > {
340
347
let master_commits = collector:: master_commits ( ) . await ?;
341
- compare_given_commits ( start, end, stat, ctxt, & master_commits) . await
348
+ compare_given_commits ( start, end, stat, ctxt, & master_commits, false ) . await
342
349
}
343
350
344
351
/// Compare two bounds on a given stat
@@ -348,6 +355,7 @@ async fn compare_given_commits(
348
355
stat : String ,
349
356
ctxt : & SiteCtxt ,
350
357
master_commits : & [ collector:: MasterCommit ] ,
358
+ calc_new_sig : bool ,
351
359
) -> Result < Option < Comparison > , BoxedError > {
352
360
let a = ctxt
353
361
. artifact_id_for_bound ( start. clone ( ) , true )
@@ -387,6 +395,7 @@ async fn compare_given_commits(
387
395
. as_ref ( )
388
396
. and_then ( |v| v. data . get ( & test_case) . cloned ( ) ) ,
389
397
results : ( a, b) ,
398
+ calc_new_sig,
390
399
} )
391
400
} )
392
401
. collect ( ) ;
@@ -650,6 +659,30 @@ impl BenchmarkVariance {
650
659
deltas
651
660
}
652
661
662
+ fn upper_fence ( & self ) -> f64 {
663
+ let pcs = self . percent_changes ( ) ;
664
+ fn median ( data : & [ f64 ] ) -> f64 {
665
+ if data. len ( ) % 2 == 0 {
666
+ ( data[ ( data. len ( ) - 1 ) / 2 ] + data[ data. len ( ) / 2 ] ) / 2.0
667
+ } else {
668
+ data[ data. len ( ) / 2 ]
669
+ }
670
+ }
671
+
672
+ let len = pcs. len ( ) ;
673
+ let ( h1_end, h2_begin) = if len % 2 == 0 {
674
+ ( len / 2 - 2 , len / 2 + 1 )
675
+ } else {
676
+ ( len / 2 - 1 , len / 2 + 1 )
677
+ } ;
678
+ // significance is determined by the upper
679
+ // interquartile range fence
680
+ let q1 = median ( & pcs[ ..=h1_end] ) ;
681
+ let q3 = median ( & pcs[ h2_begin..] ) ;
682
+ let iqr = q3 - q1;
683
+ q3 + ( iqr * 1.5 )
684
+ }
685
+
653
686
fn calculate_description ( & mut self ) {
654
687
self . description = BenchmarkVarianceDescription :: Normal ;
655
688
@@ -689,11 +722,15 @@ impl BenchmarkVariance {
689
722
}
690
723
691
724
/// Whether we can trust this benchmark or not
692
- fn is_dodgy ( & self ) -> bool {
693
- matches ! (
694
- self . description,
695
- BenchmarkVarianceDescription :: Noisy | BenchmarkVarianceDescription :: HighlyVariable
696
- )
725
+ fn is_dodgy ( & self , calc_new_sig : bool ) -> bool {
726
+ if !calc_new_sig {
727
+ matches ! (
728
+ self . description,
729
+ BenchmarkVarianceDescription :: Noisy | BenchmarkVarianceDescription :: HighlyVariable
730
+ )
731
+ } else {
732
+ self . upper_fence ( ) > 0.002
733
+ }
697
734
}
698
735
}
699
736
@@ -748,13 +785,18 @@ pub struct TestResultComparison {
748
785
scenario : Scenario ,
749
786
variance : Option < BenchmarkVariance > ,
750
787
results : ( f64 , f64 ) ,
788
+ calc_new_sig : bool ,
751
789
}
752
790
753
791
impl TestResultComparison {
754
792
/// The amount of relative change considered significant when
755
793
/// we cannot determine from historical data
756
794
const SIGNIFICANT_RELATIVE_CHANGE_THRESHOLD : f64 = 0.002 ;
757
795
796
+ /// The amount of relative change considered significant when
797
+ /// the test case is dodgy
798
+ const SIGNIFICANT_RELATIVE_CHANGE_THRESHOLD_DODGY : f64 = 0.008 ;
799
+
758
800
fn is_regression ( & self ) -> bool {
759
801
let ( a, b) = self . results ;
760
802
b > a
@@ -769,30 +811,17 @@ impl TestResultComparison {
769
811
}
770
812
771
813
fn signifcance_threshold ( & self ) -> f64 {
772
- if let Some ( pcs) = self . variance . as_ref ( ) . map ( |s| s. percent_changes ( ) ) {
773
- fn median ( data : & [ f64 ] ) -> f64 {
774
- if data. len ( ) % 2 == 0 {
775
- ( data[ ( data. len ( ) - 1 ) / 2 ] + data[ data. len ( ) / 2 ] ) / 2.0
776
- } else {
777
- data[ data. len ( ) / 2 ]
778
- }
779
- }
780
-
781
- let len = pcs. len ( ) ;
782
- let ( h1_end, h2_begin) = if len % 2 == 0 {
783
- ( len / 2 - 2 , len / 2 + 1 )
814
+ if !self . calc_new_sig {
815
+ if self . is_dodgy ( ) {
816
+ Self :: SIGNIFICANT_RELATIVE_CHANGE_THRESHOLD_DODGY
784
817
} else {
785
- ( len / 2 - 1 , len / 2 + 1 )
786
- } ;
787
- // significance is determined by the upper
788
- // interquartile range fence
789
- let q1 = median ( & pcs[ ..=h1_end] ) ;
790
- let q3 = median ( & pcs[ h2_begin..] ) ;
791
- let iqr = q3 - q1;
792
- let upper_fence = q3 + ( iqr * 1.5 ) ;
793
- upper_fence
818
+ Self :: SIGNIFICANT_RELATIVE_CHANGE_THRESHOLD
819
+ }
794
820
} else {
795
- Self :: SIGNIFICANT_RELATIVE_CHANGE_THRESHOLD
821
+ self . variance
822
+ . as_ref ( )
823
+ . map ( |s| s. upper_fence ( ) )
824
+ . unwrap_or ( Self :: SIGNIFICANT_RELATIVE_CHANGE_THRESHOLD )
796
825
}
797
826
}
798
827
@@ -810,6 +839,9 @@ impl TestResultComparison {
810
839
} else {
811
840
Magnitude :: VeryLarge
812
841
} ;
842
+ if !self . calc_new_sig {
843
+ return over_threshold;
844
+ }
813
845
let change_magnitude = if change < 0.002 {
814
846
Magnitude :: VerySmall
815
847
} else if change < 0.01 {
@@ -846,7 +878,7 @@ impl TestResultComparison {
846
878
fn is_dodgy ( & self ) -> bool {
847
879
self . variance
848
880
. as_ref ( )
849
- . map ( |v| v. is_dodgy ( ) )
881
+ . map ( |v| v. is_dodgy ( self . calc_new_sig ) )
850
882
. unwrap_or ( false )
851
883
}
852
884
0 commit comments