MCPcopy
hub / github.com/segmentio/kafka-go / BenchmarkSyncGroupResponseV0

Function BenchmarkSyncGroupResponseV0

syncgroup_test.go:231–258  ·  view source on GitHub ↗
(t *testing.B)

Source from the content-addressed store, hash-verified

229}
230
231func BenchmarkSyncGroupResponseV0(t *testing.B) {
232 item := syncGroupResponseV0{
233 ErrorCode: 2,
234 MemberAssignments: []byte(`blah`),
235 }
236
237 b := bytes.NewBuffer(nil)
238 w := &writeBuffer{w: b}
239 item.writeTo(w)
240
241 r := bytes.NewReader(b.Bytes())
242 reader := bufio.NewReader(r)
243 size := b.Len()
244
245 for i := 0; i < t.N; i++ {
246 r.Seek(0, io.SeekStart)
247 var found syncGroupResponseV0
248 remain, err := (&found).readFrom(reader, size)
249 if err != nil {
250 t.Error(err)
251 t.FailNow()
252 }
253 if remain != 0 {
254 t.Errorf("expected 0 remain, got %v", remain)
255 t.FailNow()
256 }
257 }
258}

Callers

nothing calls this directly

Calls 7

writeToMethod · 0.95
NewReaderMethod · 0.65
BytesMethod · 0.65
LenMethod · 0.65
SeekMethod · 0.45
readFromMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected