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

Function BenchmarkInt8_EncodeMsg

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

Source from the content-addressed store, hash-verified

3037}
3038
3039func BenchmarkInt8_EncodeMsg(b *testing.B) {
3040 sizes := []int{10, 100, 1000}
3041
3042 for _, size := range sizes {
3043 b.Run(fmt.Sprintf("%d", size), func(b *testing.B) {
3044 set := make(Int8)
3045 for i := 0; i < size; i++ {
3046 set[int8((i%256)-128)] = struct{}{}
3047 }
3048
3049 var buf bytes.Buffer
3050 writer := msgp.NewWriter(&buf)
3051
3052 b.ReportAllocs()
3053 b.ResetTimer()
3054 for i := 0; i < b.N; i++ {
3055 buf.Reset()
3056 writer.Reset(&buf)
3057 set.EncodeMsg(writer)
3058 writer.Flush()
3059 }
3060 })
3061 }
3062}
3063
3064func BenchmarkInt8_DecodeMsg(b *testing.B) {
3065 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…