# HG changeset patch # User Pierre-Yves David <pierre-yves.david@octobus.net> # Date 1665625937 -7200 # Thu Oct 13 03:52:17 2022 +0200 # Node ID a77685ac63a18abbe2598f883fef315febc76bb2 # Parent 428fdb8aa0cd5ec97c7aa4a77fcf41b9b0ea7338 result-compare: display percentage of change when applicable This will help getting a grasp on what is changing. diff --git a/bin/result-compare b/bin/result-compare --- a/bin/result-compare +++ b/bin/result-compare @@ -63,11 +63,24 @@ print(f'{prefix} {k} = {v}') prefix = " #" + + base = None # display the result now for r in some_results: key = r['bin-env-vars']['hg']['changeset']['node'][:12] median = r['result']['time']['median'] - print(f"{key}: {median:6.6f}") + if base is None: + base = median + display = "" + else: + change = median / base + if change <= 0.99: + perc = (1 - change) * -100 + display = f"({perc:+.2f}%)".rjust(10) + elif 1.01 <= change: + perc = (change - 1) * 100 + display = f"({perc:+.2f}%)".rjust(10) + print(f"{key}: {median:6.6f} {display}") def _parsers():