MCPcopy Create free account
hub / github.com/AdRoll/baker / BenchmarkGzip

Function BenchmarkGzip

input/inpututils/fastgzreader_test.go:113–134  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

111}
112
113func BenchmarkGzip(b *testing.B) {
114 data := getCorpus()
115 data = append(data, data...)
116 data = append(data, data...)
117 data = append(data, data...)
118 data = append(data, data...)
119 data = append(data, data...)
120
121 var buf bytes.Buffer
122 w := gzip.NewWriter(&buf)
123 w.Write(data)
124 w.Close()
125
126 data = buf.Bytes()
127 b.SetBytes(int64(len(data)))
128 gz, _ := gzip.NewReader(bytes.NewReader(data))
129
130 for i := 0; i < b.N; i++ {
131 gz.Reset(bytes.NewReader(data))
132 io.Copy(io.Discard, gz)
133 }
134}
135
136func BenchmarkFastGzip(b *testing.B) {
137 data := getCorpus()

Callers

nothing calls this directly

Calls 5

getCorpusFunction · 0.85
ResetMethod · 0.80
CloseMethod · 0.65
CopyMethod · 0.65
WriteMethod · 0.45

Tested by

no test coverage detected