bmCompressor benchmarks a compressor of a Protocol Buffer message containing mSize bytes.
(b *testing.B, mSize int, cp Compressor)
| 385 | // bmCompressor benchmarks a compressor of a Protocol Buffer message containing |
| 386 | // mSize bytes. |
| 387 | func bmCompressor(b *testing.B, mSize int, cp Compressor) { |
| 388 | payload := make([]byte, mSize) |
| 389 | cBuf := bytes.NewBuffer(make([]byte, mSize)) |
| 390 | b.ReportAllocs() |
| 391 | b.ResetTimer() |
| 392 | for i := 0; i < b.N; i++ { |
| 393 | cp.Do(cBuf, payload) |
| 394 | cBuf.Reset() |
| 395 | } |
| 396 | } |
| 397 | |
| 398 | func BenchmarkGZIPCompressor1B(b *testing.B) { |
| 399 | bmCompressor(b, 1, NewGZIPCompressor()) |
no test coverage detected