Skip to content

Commit

Permalink
meh
Browse files Browse the repository at this point in the history
  • Loading branch information
feisuzhu committed Mar 29, 2023
1 parent 973c8f7 commit ecf9f12
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion .github/workflows/scripts/post-benchmark-to-github-pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ def flatten_metric(m):
return (f'{m["name"]}@{tags}', m['value'])


def fmt(v):
if 0 < abs(v) < 1:
return f'{v:.3g}'
else:
return f'{v:.3f}'


def render_result(baseline, sha, rs):
texts = []
_ = texts.append
Expand All @@ -66,7 +73,7 @@ def render_result(baseline, sha, rs):

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

_(fr'| {name} | {rv:.2f} | {cv:.2f} | $\textcolor{{{color}}}{{\textsf{{{rate}\\%}}}}$ |'
_(fr'| {name} | {fmt(rv)} | {fmt(cv)} | $\textcolor{{{color}}}{{\textsf{{{rate}\\%}}}}$ |'
)

return '\n'.join(texts)
Expand Down

0 comments on commit ecf9f12

Please sign in to comment.