Skip to content

Commit

Permalink
Better time units
Browse files Browse the repository at this point in the history
  • Loading branch information
sampsyo committed May 1, 2024
1 parent 3e042d5 commit 8f6faf8
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions bench/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,18 @@ def summary():
mean = float(row["mean"])
stddev = float(row["stddev"])

if mean < 0.2:
mean *= 1000
stddev *= 1000
unit = "ms"
if mean > 80:
mins = int(mean / 60)
secs = int(mean % 60)
print(f" {cmd}: {mins}m{secs}s ± {stddev:.1f}")
else:
unit = "s"

print(f" {cmd}: {mean:.1f} ± {stddev:.1f} {unit}")
if mean < 0.2:
mean *= 1000
stddev *= 1000
unit = "ms"
else:
unit = "s"
print(f" {cmd}: {mean:.1f} ± {stddev:.1f} {unit}")


if __name__ == "__main__":
Expand Down

0 comments on commit 8f6faf8

Please sign in to comment.