* export bench=encode-v1 && go test ./util/compression/... \ -run '^$' -bench '^BenchmarkEncode' \ -benchtime 5s -count 6 -cpu 2 -timeout 999m \ | tee ${bench}.txt */
(b *testing.B)
| 147 | | tee ${bench}.txt |
| 148 | */ |
| 149 | func BenchmarkEncode(b *testing.B) { |
| 150 | for _, typ := range Types() { |
| 151 | b.Run(fmt.Sprintf("type=%v", typ), func(b *testing.B) { |
| 152 | var buf EncodeBuffer |
| 153 | compressible := []byte(compressible) |
| 154 | |
| 155 | b.ReportAllocs() |
| 156 | b.ResetTimer() |
| 157 | for b.Loop() { |
| 158 | if buf == nil { |
| 159 | buf = NewSyncEncodeBuffer() |
| 160 | } |
| 161 | res, err := Encode(typ, compressible, buf) |
| 162 | require.NoError(b, err) |
| 163 | b.ReportMetric(float64(len(res)), "B") |
| 164 | } |
| 165 | }) |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | /* |
| 170 | export bench=decode-v1 && go test ./util/compression/... \ |
nothing calls this directly
no test coverage detected
searching dependent graphs…