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

Function BenchmarkFastGzip

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

Source from the content-addressed store, hash-verified

134}
135
136func BenchmarkFastGzip(b *testing.B) {
137 data := getCorpus()
138 data = append(data, data...)
139 data = append(data, data...)
140 data = append(data, data...)
141 data = append(data, data...)
142 data = append(data, data...)
143
144 var buf bytes.Buffer
145 w := gzip.NewWriter(&buf)
146 w.Write(data)
147 w.Close()
148
149 data = buf.Bytes()
150 b.SetBytes(int64(len(data)))
151 gz, _ := newFastGzReader(bytes.NewReader(data))
152
153 for i := 0; i < b.N; i++ {
154 gz.Reset(bytes.NewReader(data))
155 io.Copy(io.Discard, gz)
156 }
157}

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected