Skip to content

Commit 48dff2b

Browse files
authored
Merge pull request #20231 from eeckstein/smoke-bench
benchmarks: combine everything which is needed into run_smoke_bench
2 parents 4709bf4 + 040aa06 commit 48dff2b

File tree

3 files changed

+378
-32
lines changed

3 files changed

+378
-32
lines changed

benchmark/scripts/compare_perf_tests.py

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -540,12 +540,10 @@ class ReportFormatter(object):
540540
GitHub), `git` and `html`.
541541
"""
542542

543-
def __init__(self, comparator, old_branch, new_branch, changes_only,
543+
def __init__(self, comparator, changes_only,
544544
single_table=False):
545545
"""Initialize with `TestComparator` and names of branches."""
546546
self.comparator = comparator
547-
self.old_branch = old_branch
548-
self.new_branch = new_branch
549547
self.changes_only = changes_only
550548
self.single_table = single_table
551549

@@ -663,7 +661,6 @@ def table(title, results, is_strong=False, is_open=False):
663661
])
664662

665663
return ''.join([
666-
# FIXME print self.old_branch, self.new_branch
667664
table('Regression', self.comparator.decreased, True, True),
668665
table('Improvement', self.comparator.increased, True),
669666
('' if self.changes_only else
@@ -738,7 +735,6 @@ def table(title, results, speedup_color):
738735

739736
return self.HTML.format(
740737
''.join([
741-
# FIXME print self.old_branch, self.new_branch
742738
table('Regression', self.comparator.decreased, 'red'),
743739
table('Improvement', self.comparator.increased, 'green'),
744740
('' if self.changes_only else
@@ -768,31 +764,33 @@ def parse_args(args):
768764
'--single-table',
769765
help='Combine data in a single table in git and markdown formats',
770766
action='store_true')
771-
parser.add_argument('--new-branch',
772-
help='Name of the new branch', default='NEW_MIN')
773-
parser.add_argument('--old-branch',
774-
help='Name of the old branch', default='OLD_MIN')
775767
parser.add_argument('--delta-threshold',
776768
help='Delta threshold. Default 0.05.',
777769
type=float, default=0.05)
778770
return parser.parse_args(args)
779771

780772

781-
def main():
782-
"""Compare benchmarks for changes in a formatted report."""
783-
args = parse_args(sys.argv[1:])
784-
comparator = TestComparator(LogParser.results_from_file(args.old_file),
785-
LogParser.results_from_file(args.new_file),
786-
args.delta_threshold)
787-
formatter = ReportFormatter(comparator, args.old_branch, args.new_branch,
788-
args.changes_only, args.single_table)
773+
def create_report(old_results, new_results, delta_threshold, format,
774+
changes_only=True, single_table=True):
775+
comparator = TestComparator(old_results, new_results, delta_threshold)
776+
formatter = ReportFormatter(comparator, changes_only, single_table)
789777
formats = {
790778
'markdown': formatter.markdown,
791779
'git': formatter.git,
792780
'html': formatter.html
793781
}
794782

795-
report = formats[args.format]()
783+
report = formats[format]()
784+
return report
785+
786+
787+
def main():
788+
"""Compare benchmarks for changes in a formatted report."""
789+
args = parse_args(sys.argv[1:])
790+
report = create_report(LogParser.results_from_file(args.old_file),
791+
LogParser.results_from_file(args.new_file),
792+
args.delta_threshold, args.format,
793+
args.changes_only, args.single_table)
796794
print(report)
797795

798796
if args.output:

0 commit comments

Comments
 (0)