MCPcopy
hub / github.com/grpc/grpc-go / bmCompressor

Function bmCompressor

rpc_util_test.go:387–396  ·  view source on GitHub ↗

bmCompressor benchmarks a compressor of a Protocol Buffer message containing mSize bytes.

(b *testing.B, mSize int, cp Compressor)

Source from the content-addressed store, hash-verified

385// bmCompressor benchmarks a compressor of a Protocol Buffer message containing
386// mSize bytes.
387func 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
398func BenchmarkGZIPCompressor1B(b *testing.B) {
399 bmCompressor(b, 1, NewGZIPCompressor())

Calls 2

ResetMethod · 0.95
DoMethod · 0.65

Tested by

no test coverage detected