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

Function BenchmarkInt8Sorted_EncodeMsg

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

Source from the content-addressed store, hash-verified

3174}
3175
3176func BenchmarkInt8Sorted_EncodeMsg(b *testing.B) {
3177 sizes := []int{10, 100, 1000}
3178
3179 for _, size := range sizes {
3180 b.Run(fmt.Sprintf("%d", size), func(b *testing.B) {
3181 set := make(Int8Sorted)
3182 for i := 0; i < size; i++ {
3183 set[int8((i%256)-128)] = struct{}{}
3184 }
3185
3186 var buf bytes.Buffer
3187 writer := msgp.NewWriter(&buf)
3188
3189 b.ReportAllocs()
3190 b.ResetTimer()
3191 for i := 0; i < b.N; i++ {
3192 buf.Reset()
3193 writer.Reset(&buf)
3194 set.EncodeMsg(writer)
3195 writer.Flush()
3196 }
3197 })
3198 }
3199}
3200
3201func BenchmarkInt8Sorted_DecodeMsg(b *testing.B) {
3202 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…