@@ -165,8 +165,8 @@ def format_difference(compare: Iterable[Result], base: Iterable[Result]) -> str:
165165 :param base: The results to compare against
166166 """
167167
168- compare_set = set ( result .corpus_entry for result in compare )
169- base_set = set ( result .corpus_entry for result in base )
168+ compare_set = { result .corpus_entry for result in compare }
169+ base_set = { result .corpus_entry for result in base }
170170
171171 s = str (len (compare_set ))
172172
@@ -293,6 +293,22 @@ def report_slowest(results_dir: str, python_versions: str, minifier_sha: str) ->
293293 for entry in sorted (summary .entries .values (), key = lambda entry : entry .time , reverse = True )[:10 ]:
294294 yield f'| { entry .corpus_entry } | { entry .original_size } | { entry .minified_size } | { entry .time :.3f} |'
295295
296+ def format_size_change_detail (summary , base_summary ) -> str :
297+ mean_percent_of_original_change = summary .mean_percent_of_original - base_summary .mean_percent_of_original
298+
299+ s = f'{ summary .mean_percent_of_original :.3f} % ({ mean_percent_of_original_change :+.3f} %'
300+
301+ got_bigger_count = len (list (summary .compare_size_increase (base_summary )))
302+ got_smaller_count = len (list (summary .compare_size_decrease (base_summary )))
303+
304+ if got_bigger_count > 0 :
305+ s += f', { got_bigger_count } :chart_with_upwards_trend:'
306+ if got_smaller_count > 0 :
307+ s += f', { got_smaller_count } :chart_with_downwards_trend:'
308+
309+ s += ')'
310+
311+ return s
296312
297313def report (results_dir : str , minifier_ref : str , minifier_sha : str , base_ref : str , base_sha : str ) -> Iterable [str ]:
298314 """
@@ -336,28 +352,11 @@ def report(results_dir: str, minifier_ref: str, minifier_sha: str, base_ref: str
336352
337353 mean_time_change = summary .mean_time - base_summary .mean_time
338354
339- def format_size_change_detail () -> str :
340- mean_percent_of_original_change = summary .mean_percent_of_original - base_summary .mean_percent_of_original
341-
342- s = f'{ summary .mean_percent_of_original :.3f} % ({ mean_percent_of_original_change :+.3f} %'
343-
344- got_bigger_count = len (list (summary .compare_size_increase (base_summary )))
345- got_smaller_count = len (list (summary .compare_size_decrease (base_summary )))
346-
347- if got_bigger_count > 0 :
348- s += f', { got_bigger_count } :chart_with_upwards_trend:'
349- if got_smaller_count > 0 :
350- s += f', { got_smaller_count } :chart_with_downwards_trend:'
351-
352- s += ')'
353-
354- return s
355-
356355 yield (
357356 f'| { python_version } ' +
358357 f'| { summary .valid_count } ' +
359358 f'| { summary .mean_time :.3f} ({ mean_time_change :+.3f} ) ' +
360- f'| { format_size_change_detail ()} ' +
359+ f'| { format_size_change_detail (summary , base_summary )} ' +
361360 f'| { format_difference (summary .larger_than_original (), base_summary .larger_than_original ())} ' +
362361 f'| { format_difference (summary .recursion_error (), base_summary .recursion_error ())} ' +
363362 f'| { format_difference (summary .unstable_minification (), base_summary .unstable_minification ())} ' +
0 commit comments