(benchmarkName string)
| 92 | } |
| 93 | |
| 94 | func getBenchmarkRows(benchmarkName string) (string, error) { |
| 95 | benchmarkOutput, err := getBenchmarkOutput(benchmarkName) |
| 96 | if err != nil { |
| 97 | return "", err |
| 98 | } |
| 99 | |
| 100 | // get the Zap time (unsugared) as baseline to compare with other loggers |
| 101 | baseline, err := getBenchmarkRow(benchmarkOutput, benchmarkName, "Zap", nil) |
| 102 | if err != nil { |
| 103 | return "", err |
| 104 | } |
| 105 | |
| 106 | var benchmarkRows []*benchmarkRow |
| 107 | for libraryName := range libraryNameToMarkdownName { |
| 108 | benchmarkRow, err := getBenchmarkRow( |
| 109 | benchmarkOutput, benchmarkName, libraryName, baseline, |
| 110 | ) |
| 111 | if err != nil { |
| 112 | return "", err |
| 113 | } |
| 114 | if benchmarkRow == nil { |
| 115 | continue |
| 116 | } |
| 117 | benchmarkRows = append(benchmarkRows, benchmarkRow) |
| 118 | } |
| 119 | sort.Sort(benchmarkRowsByTime(benchmarkRows)) |
| 120 | rows := []string{ |
| 121 | "| Package | Time | Time % to zap | Objects Allocated |", |
| 122 | "| :------ | :--: | :-----------: | :---------------: |", |
| 123 | } |
| 124 | for _, benchmarkRow := range benchmarkRows { |
| 125 | rows = append(rows, benchmarkRow.String()) |
| 126 | } |
| 127 | return strings.Join(rows, "\n"), nil |
| 128 | } |
| 129 | |
| 130 | func getBenchmarkRow( |
| 131 | input []string, benchmarkName string, libraryName string, baseline *benchmarkRow, |
no test coverage detected