MCPcopy Index your code
hub / github.com/prometheus/prometheus / BenchmarkDecode

Function BenchmarkDecode

util/compression/compression_test.go:175–193  ·  view source on GitHub ↗

* export bench=decode-v1 && go test ./util/compression/... \ -run '^$' -bench '^BenchmarkDecode' \ -benchtime 5s -count 6 -cpu 2 -timeout 999m \ | tee ${bench}.txt */

(b *testing.B)

Source from the content-addressed store, hash-verified

173 | tee ${bench}.txt
174*/
175func BenchmarkDecode(b *testing.B) {
176 for _, typ := range Types() {
177 b.Run(fmt.Sprintf("type=%v", typ), func(b *testing.B) {
178 var buf DecodeBuffer
179 res, err := Encode(typ, []byte(compressible), NewConcurrentEncodeBuffer())
180 require.NoError(b, err)
181
182 b.ReportAllocs()
183 b.ResetTimer()
184 for b.Loop() {
185 if buf == nil {
186 buf = NewSyncDecodeBuffer()
187 }
188 _, err := Decode(typ, res, buf)
189 require.NoError(b, err)
190 }
191 })
192 }
193}

Callers

nothing calls this directly

Calls 6

TypesFunction · 0.85
NewSyncDecodeBufferFunction · 0.85
EncodeFunction · 0.70
DecodeFunction · 0.70
RunMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…