@@ -329,24 +329,24 @@ class ResultComparison(object):
329
329
It computes speedup ratio and improvement delta (%).
330
330
"""
331
331
332
- def __init__ (self , old , new ):
332
+ def __init__ (self , old_result , new_result ):
333
333
"""Initialize with old and new `PerformanceTestResult`s to compare."""
334
- self .old = old
335
- self .new = new
336
- assert old .name == new .name
337
- self .name = old .name # Test name, convenience accessor
334
+ self .old = old_result
335
+ self .new = new_result
336
+ assert old_result .name == new_result .name
337
+ self .name = old_result .name # Test name, convenience accessor
338
338
339
- # Speedup ratio
340
- self .ratio = (old .min + 0.001 ) / (new .min + 0.001 )
339
+ # Location estimates + "epsilon" to prevent division by 0
340
+ old = old_result .min + 0.001
341
+ new = new_result .min + 0.001
341
342
342
- # Test runtime improvement in %
343
- ratio = (new .min + 0.001 ) / (old .min + 0.001 )
344
- self .delta = ((ratio - 1 ) * 100 )
343
+ self .ratio = old / new # Speedup ratio
344
+ self .delta = ((new / old ) - 1 ) * 100 # Test runtime improvement in %
345
345
346
- # Indication of dubious changes: when result's MIN falls inside the
347
- # (MIN, MAX) interval of result they are being compared with.
348
- self . is_dubious = (( old .min < new . min and new .min < old . max ) or
349
- ( new . min < old . min and old . min < new . max ) )
346
+ # Indication of dubious changes: when results' ranges overlap
347
+ o_min , o_max , n_min , n_max = \
348
+ self . old .min , self . old . max , self . new .min , self . new . max
349
+ self . is_dubious = ( o_min <= n_max and n_min <= o_max )
350
350
351
351
352
352
class LogParser (object ):
@@ -695,11 +695,16 @@ def format_columns(r, is_strong):
695
695
return (r if not is_strong else
696
696
r [:- 1 ] + (bold_first (r [- 1 ]), ))
697
697
698
- def table (title , results , is_strong = False , is_open = False ):
698
+ def table (title , results , is_strong = False , is_open = False ,
699
+ mark_dubious = True ):
699
700
if not results :
700
701
return ''
702
+
703
+ def dubious (r ):
704
+ return ventile_formatter (r ) if mark_dubious else ''
705
+
701
706
rows = [row (format_columns (
702
- ReportFormatter .values (r , ventile_formatter ), is_strong ))
707
+ ReportFormatter .values (r , dubious ), is_strong ))
703
708
for r in results ]
704
709
table = (header (title if self .single_table else '' ,
705
710
ReportFormatter .header_for (results [0 ])) +
@@ -712,7 +717,8 @@ def table(title, results, is_strong=False, is_open=False):
712
717
table ('Regression' , self .comparator .decreased , True , True ),
713
718
table ('Improvement' , self .comparator .increased , True ),
714
719
('' if self .changes_only else
715
- table ('No Changes' , self .comparator .unchanged )),
720
+ table ('No Changes' , self .comparator .unchanged ,
721
+ mark_dubious = False )),
716
722
table ('Added' , self .comparator .added , is_open = True ),
717
723
table ('Removed' , self .comparator .removed , is_open = True )
718
724
])
@@ -771,9 +777,12 @@ def row(name, old, new, delta, speedup, speedup_color):
771
777
def header (contents ):
772
778
return self .HTML_HEADER_ROW .format (* contents )
773
779
774
- def table (title , results , speedup_color ):
780
+ def table (title , results , speedup_color , mark_dubious = True ):
781
+ def dubious (r ):
782
+ return ' (?)' if mark_dubious else ''
783
+
775
784
rows = [
776
- row (* (ReportFormatter .values (r ) + (speedup_color ,)))
785
+ row (* (ReportFormatter .values (r , dubious ) + (speedup_color ,)))
777
786
for r in results
778
787
]
779
788
return ('' if not rows else
@@ -786,7 +795,8 @@ def table(title, results, speedup_color):
786
795
table ('Regression' , self .comparator .decreased , 'red' ),
787
796
table ('Improvement' , self .comparator .increased , 'green' ),
788
797
('' if self .changes_only else
789
- table ('No Changes' , self .comparator .unchanged , 'black' )),
798
+ table ('No Changes' , self .comparator .unchanged , 'black' ,
799
+ mark_dubious = False )),
790
800
table ('Added' , self .comparator .added , '' ),
791
801
table ('Removed' , self .comparator .removed , '' )
792
802
]))
0 commit comments