MCPcopy
hub / github.com/tinylib/msgp / BenchmarkByte_EncodeMsg

Function BenchmarkByte_EncodeMsg

msgp/setof/generated_test.go:2379–2402  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

2377}
2378
2379func BenchmarkByte_EncodeMsg(b *testing.B) {
2380 sizes := []int{10, 100, 1000}
2381
2382 for _, size := range sizes {
2383 b.Run(fmt.Sprintf("%d", size), func(b *testing.B) {
2384 set := make(Byte)
2385 for i := 0; i < size; i++ {
2386 set[byte(i%256)] = struct{}{}
2387 }
2388
2389 var buf bytes.Buffer
2390 writer := msgp.NewWriter(&buf)
2391
2392 b.ReportAllocs()
2393 b.ResetTimer()
2394 for i := 0; i < b.N; i++ {
2395 buf.Reset()
2396 writer.Reset(&buf)
2397 set.EncodeMsg(writer)
2398 writer.Flush()
2399 }
2400 })
2401 }
2402}
2403
2404func BenchmarkByte_DecodeMsg(b *testing.B) {
2405 sizes := []int{10, 100, 1000}

Callers

nothing calls this directly

Calls 5

ResetMethod · 0.95
FlushMethod · 0.95
NewWriterFunction · 0.92
EncodeMsgMethod · 0.65
ResetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…