MCPcopy Index your code
hub / github.com/tinylib/msgp / BenchmarkInt8Sorted_DecodeMsg

Function BenchmarkInt8Sorted_DecodeMsg

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

Source from the content-addressed store, hash-verified

3199}
3200
3201func BenchmarkInt8Sorted_DecodeMsg(b *testing.B) {
3202 sizes := []int{10, 100, 1000}
3203
3204 for _, size := range sizes {
3205 b.Run(fmt.Sprintf("%d", size), func(b *testing.B) {
3206 set := make(Int8Sorted)
3207 for i := 0; i < size; i++ {
3208 set[int8((i%256)-128)] = struct{}{}
3209 }
3210
3211 var buf bytes.Buffer
3212 writer := msgp.NewWriter(&buf)
3213 set.EncodeMsg(writer)
3214 writer.Flush()
3215 encoded := buf.Bytes()
3216
3217 b.ReportAllocs()
3218 b.ResetTimer()
3219 for i := 0; i < b.N; i++ {
3220 reader := msgp.NewReader(bytes.NewReader(encoded))
3221 var decoded Int8Sorted
3222 decoded.DecodeMsg(reader)
3223 }
3224 })
3225 }
3226}
3227
3228func BenchmarkInt8Sorted_MarshalMsg(b *testing.B) {
3229 sizes := []int{10, 100, 1000}

Callers

nothing calls this directly

Calls 5

FlushMethod · 0.95
DecodeMsgMethod · 0.95
NewWriterFunction · 0.92
NewReaderFunction · 0.92
EncodeMsgMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…