Skip to content

Commit 482da83

Browse files
committed
Fix create comment for no stat sig benchmarks
1 parent b4c60dc commit 482da83

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

.evergreen/perfcomp/cmd/perfcomp/compare.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,24 +67,27 @@ func newCompareCommand() *cobra.Command {
6767

6868
func createComment(result perfcomp.CompareResult) string {
6969
var comment strings.Builder
70-
fmt.Fprintf(&comment, "The following benchmark tests for version %s had statistically significant changes (i.e., |z-score| > 1.96):\n\n", result.Version)
71-
72-
w := tabwriter.NewWriter(&comment, 0, 0, 1, ' ', 0)
73-
fmt.Fprintln(w, "| Benchmark\t| Measurement\t| % Change\t| Patch Value\t| Stable Region\t| H-Score\t| Z-Score\t| ")
74-
fmt.Fprintln(w, "| ---------\t| -----------\t| --------\t| -----------\t| -------------\t| -------\t| -------\t|")
7570

7671
if len(result.SigEnergyStats) == 0 {
7772
comment.Reset()
7873
fmt.Fprintf(&comment, "There were no significant changes to the performance to report for version %s.\n", result.Version)
7974
} else {
75+
fmt.Fprintf(&comment, "The following benchmark tests for version %s had statistically significant changes (i.e., |z-score| > 1.96):\n\n", result.Version)
76+
77+
w := tabwriter.NewWriter(&comment, 0, 0, 1, ' ', 0)
78+
79+
fmt.Fprintln(w, "| Benchmark\t| Measurement\t| % Change\t| Patch Value\t| Stable Region\t| H-Score\t| Z-Score\t| ")
80+
fmt.Fprintln(w, "| ---------\t| -----------\t| --------\t| -----------\t| -------------\t| -------\t| -------\t|")
81+
8082
sort.Slice(result.SigEnergyStats, func(i, j int) bool {
8183
return math.Abs(result.SigEnergyStats[i].PercentChange) > math.Abs(result.SigEnergyStats[j].PercentChange)
8284
})
8385
for _, es := range result.SigEnergyStats {
8486
fmt.Fprintf(w, "| %s\t| %s\t| %.4f\t| %.4f\t| Avg: %.4f, Med: %.4f, Stdev: %.4f\t| %.4f\t| %.4f\t|\n", es.Benchmark, es.Measurement, es.PercentChange, es.MeasurementVal, es.StableRegion.Mean, es.StableRegion.Median, es.StableRegion.Std, es.HScore, es.ZScore)
8587
}
88+
89+
w.Flush()
8690
}
87-
w.Flush()
8891

8992
comment.WriteString("\n*For a comprehensive view of all microbenchmark results for this PR's commit, please check out the Evergreen perf task for this patch.*")
9093
return comment.String()

0 commit comments

Comments
 (0)