[Git][ghc/ghc][wip/perf-notes-fixes] testsuite: Handle division-by-zero more gracefully
Matthew Pickering (@mpickering)
gitlab at gitlab.haskell.org
Wed Oct 2 09:14:12 UTC 2024
Matthew Pickering pushed to branch wip/perf-notes-fixes at Glasgow Haskell Compiler / GHC
Commits:
73d3fab7 by Ben Gamari at 2024-10-02T10:13:35+01:00
testsuite: Handle division-by-zero more gracefully
Previously we would fail with an ZeroDivisionError.
Fixes #25321
- - - - -
1 changed file:
- testsuite/driver/runtests.py
Changes:
=====================================
testsuite/driver/runtests.py
=====================================
@@ -404,7 +404,10 @@ def tabulate_metrics(metrics: List[PerfMetric]) -> None:
return ""
val0 = x.baseline.perfStat.value
val1 = x.stat.value
- return "{:+2.1f}%".format(100 * (val1 - val0) / val0)
+ if val0 == 0:
+ return "NaN%"
+ else:
+ return "{:+2.1f}%".format(100 * (val1 - val0) / val0)
dataRows = [row((
"{}({})".format(x.stat.test, x.stat.way),
shorten_metric_name(x.stat.metric),
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/73d3fab7f28dbbf7e7ec1e818a72d8c024d99c3a
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/73d3fab7f28dbbf7e7ec1e818a72d8c024d99c3a
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20241002/2dc2455a/attachment.html>
More information about the ghc-commits
mailing list