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

Function BenchmarkUint8_EncodeMsg

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

Source from the content-addressed store, hash-verified

3697}
3698
3699func BenchmarkUint8_EncodeMsg(b *testing.B) {
3700 sizes := []int{10, 100, 1000}
3701
3702 for _, size := range sizes {
3703 b.Run(fmt.Sprintf("%d", size), func(b *testing.B) {
3704 set := make(Uint8)
3705 for i := 0; i < size; i++ {
3706 set[uint8(i%256)] = struct{}{}
3707 }
3708
3709 var buf bytes.Buffer
3710 writer := msgp.NewWriter(&buf)
3711
3712 b.ReportAllocs()
3713 b.ResetTimer()
3714 for i := 0; i < b.N; i++ {
3715 buf.Reset()
3716 writer.Reset(&buf)
3717 set.EncodeMsg(writer)
3718 writer.Flush()
3719 }
3720 })
3721 }
3722}
3723
3724func BenchmarkUint8_DecodeMsg(b *testing.B) {
3725 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…