Skip to content

Commit

Permalink
prettier output formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
paulk-asert committed Sep 11, 2024
1 parent e1c008e commit 29f5a1e
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ class PerformanceTestSummary extends DefaultTask {

versions = versions.sort { ((List) it)[1] }
def fastest = ((List) versions[0])[1]
def df = new DecimalFormat("#.##")
versions.each { version, mean, stdDev ->
print "Groovy $version Average ${mean}ms ± ${new DecimalFormat("#.##").format(stdDev)}ms "
print "Groovy ${sprintf '%-20s', version} Average ${df.format(mean)}ms ± ${df.format(stdDev)}ms "
if (mean > fastest) {
def diff = 100 * (mean - fastest) / fastest
print "(${new DecimalFormat("#.##").format(diff)}% slower)"
print "(${df.format(diff)}% slower)"
}
println()
}
Expand Down

0 comments on commit 29f5a1e

Please sign in to comment.