MCPcopy
hub / github.com/kopia/kopia / compressionBenchmark

Function compressionBenchmark

repo/compression/compressor_test.go:137–152  ·  view source on GitHub ↗
(b *testing.B, comp Compressor, input []byte, output *bytes.Buffer)

Source from the content-addressed store, hash-verified

135}
136
137func compressionBenchmark(b *testing.B, comp Compressor, input []byte, output *bytes.Buffer) {
138 b.Helper()
139 b.ReportAllocs()
140
141 rdr := bytes.NewReader(input)
142
143 for b.Loop() {
144 output.Reset()
145 rdr.Reset(input)
146
147 if err := comp.Compress(output, rdr); err != nil {
148 b.Fatalf("compression error %v", err)
149 return
150 }
151 }
152}
153
154func decompressionBenchmark(b *testing.B, comp Compressor, input []byte, output *bytes.Buffer) {
155 b.Helper()

Callers 1

BenchmarkCompressorFunction · 0.85

Calls 4

HelperMethod · 0.80
FatalfMethod · 0.80
ResetMethod · 0.65
CompressMethod · 0.65

Tested by

no test coverage detected