Skip to content

Commit ecf9f12

Browse files
committed
meh
1 parent 973c8f7 commit ecf9f12

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

.github/workflows/scripts/post-benchmark-to-github-pr.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ def flatten_metric(m):
4747
return (f'{m["name"]}@{tags}', m['value'])
4848

4949

50+
def fmt(v):
51+
if 0 < abs(v) < 1:
52+
return f'{v:.3g}'
53+
else:
54+
return f'{v:.3f}'
55+
56+
5057
def render_result(baseline, sha, rs):
5158
texts = []
5259
_ = texts.append
@@ -66,7 +73,7 @@ def render_result(baseline, sha, rs):
6673

6774
rate = f'{" +"[rate > 0]}{rate:.2f}'
6875

69-
_(fr'| {name} | {rv:.2f} | {cv:.2f} | $\textcolor{{{color}}}{{\textsf{{{rate}\\%}}}}$ |'
76+
_(fr'| {name} | {fmt(rv)} | {fmt(cv)} | $\textcolor{{{color}}}{{\textsf{{{rate}\\%}}}}$ |'
7077
)
7178

7279
return '\n'.join(texts)

0 commit comments

Comments
 (0)