MCPcopy
hub / github.com/grafana/dskit / BenchmarkSnappyDecompress

Function BenchmarkSnappyDecompress

grpcencoding/snappy/snappy_test.go:57–70  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

55}
56
57func BenchmarkSnappyDecompress(b *testing.B) {
58 data := []byte(strings.Repeat("123456789", 1024))
59 c := newCompressor()
60 var buf bytes.Buffer
61 w, _ := c.Compress(&buf)
62 _, _ = w.Write(data)
63 reader := bytes.NewReader(buf.Bytes())
64 b.ResetTimer()
65 for i := 0; i < b.N; i++ {
66 r, _ := c.Decompress(reader)
67 _, _ = io.ReadAll(r)
68 _, _ = reader.Seek(0, io.SeekStart)
69 }
70}

Callers

nothing calls this directly

Calls 4

newCompressorFunction · 0.85
CompressMethod · 0.80
DecompressMethod · 0.80
WriteMethod · 0.45

Tested by

no test coverage detected