Skip to content

Commit ce710ae

Browse files
committed
Reiterate on display and include comments
1 parent bf44195 commit ce710ae

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

internal/cmd/perfcomp/main.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,11 +321,15 @@ func generatePRComment(energyStats []*EnergyStats, version string) string {
321321
fmt.Fprintf(&comment, "The following benchmark tests for version %s had statistically significant changes (i.e., |z-score| > 1.96):\n\n", version)
322322

323323
w := tabwriter.NewWriter(&comment, 0, 0, 1, ' ', 0)
324-
fmt.Fprintln(w, "| Benchmark\t| Measurement\t| H-Score\t| Z-Score\t| % Change\t| Stable Reg\t| Patch Value\t|")
325-
fmt.Fprintln(w, "| ---------\t| -----------\t| -------\t| -------\t| --------\t| ----------\t| -----------\t|")
324+
fmt.Fprintln(w, "| Benchmark\t| Measurement\t| % Change\t| Patch Value\t| Stable Region\t| H-Score\t| Z-Score\t| ")
325+
fmt.Fprintln(w, "| ---------\t| -----------\t| --------\t| -----------\t| -------------\t| -------\t| -------\t|")
326326

327327
var significantEnergyStats []EnergyStats
328328
for _, es := range energyStats {
329+
// The "iterations" measurement is the number of iterations that the Go
330+
// benchmark suite had to run to converge on a benchmark measurement. It
331+
// is not comparable between benchmark runs, so is not a useful
332+
// measurement to print here. Omit it.
329333
if es.Measurement != "iterations" && math.Abs(es.ZScore) > 1.96 {
330334
significantEnergyStats = append(significantEnergyStats, *es)
331335
}
@@ -339,7 +343,7 @@ func generatePRComment(energyStats []*EnergyStats, version string) string {
339343
return math.Abs(significantEnergyStats[i].PercentChange) > math.Abs(significantEnergyStats[j].PercentChange)
340344
})
341345
for _, es := range significantEnergyStats {
342-
fmt.Fprintf(w, "| %s\t| %s\t| %.4f\t| %.4f\t| %.4f\t| Avg: %.4f, Med: %.4f, Stdev: %.4f\t| %.4f\t|\n", es.Benchmark, es.Measurement, es.HScore, es.ZScore, es.PercentChange, es.StableRegion.Mean, es.StableRegion.Median, es.StableRegion.Std, es.MeasurementVal)
346+
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)
343347
}
344348
}
345349
w.Flush()

internal/cmd/perfcomp/parseperfcomp/main.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ const parsePerfCompDir = "./internal/cmd/perfcomp/parseperfcomp/"
1919
const perfReportFileTxt = "perf-report.txt"
2020
const perfReportFileMd = "perf-report.md"
2121
const perfVariant = "^perf$"
22+
const hscoreDefLink = "https://en.wikipedia.org/wiki/Energy_distance#:~:text=E%2Dcoefficient%20of%20inhomogeneity"
23+
const zscoreDefLink = "https://en.wikipedia.org/wiki/Standard_score#Calculation"
2224

2325
func main() {
2426
var line string
@@ -71,6 +73,15 @@ func main() {
7173
} else {
7274
printUrlToLine(fWrite, line, evgLink, "Evergreen", 0)
7375
}
76+
} else if strings.Contains(line, ", ") {
77+
line = strings.ReplaceAll(line, ", ", "<br>")
78+
fmt.Fprintf(fWrite, "%s\n", line)
79+
} else if strings.Contains(line, "H-Score") {
80+
linkedWord := "[H-Score](" + hscoreDefLink + ")"
81+
line = strings.ReplaceAll(line, "H-Score", linkedWord)
82+
linkedWord = "[Z-Score](" + zscoreDefLink + ")"
83+
line = strings.ReplaceAll(line, "Z-Score", linkedWord)
84+
fmt.Fprintf(fWrite, "%s\n", line)
7485
} else {
7586
// all other regular lines
7687
fmt.Fprintf(fWrite, "%s\n", line)

0 commit comments

Comments
 (0)