On 21.10.20 16:58, Vladimir Sementsov-Ogievskiy wrote:
Performance improvements / degradations are usually discussed in
percentage. Let's make the script calculate it for us.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsement...@virtuozzo.com>
---
  scripts/simplebench/results_to_text.py | 67 +++++++++++++++++++++++---
  1 file changed, 60 insertions(+), 7 deletions(-)

diff --git a/scripts/simplebench/results_to_text.py 
b/scripts/simplebench/results_to_text.py
index 479f7ac1d4..56fdacf7ca 100644
--- a/scripts/simplebench/results_to_text.py
+++ b/scripts/simplebench/results_to_text.py

[...]

+            for j in range(0, i):
+                env_j = results['envs'][j]
+                res_j = case_results[env_j['id']]
+                cell += ' '
+
+                if 'average' not in res_j:
+                    # Failed result
+                    cell += '--'
+                    continue
+
+                col_j = tab[0][j + 1] if named_columns else ''
+                diff_pr = round((res['average'] - res_j['average']) /
+                                res_j['average'] * 100)
+                cell += f' {col_j}{diff_pr:+}%'

Contrasting to v6, you added the "cell += ' '" line, dropped a space in the "cell += '--'" line (was: "cell += ' --'"), but kept the space here. I would have assumed that the leading space is dropped here, too. But I don’t quite know, what I should be expecting, so.

Anyway, I’ll just leave this here:

Reviewed-by: Max Reitz <mre...@redhat.com>

+            row.append(cell)
+        tab.append(row)
+
+    return f'All results are in {dim}\n\n' + tabulate.tabulate(tab)



Reply via email to