MCPcopy Create free account
hub / github.com/tinylib/msgp / BenchmarkInt32Sorted_DecodeMsg

Function BenchmarkInt32Sorted_DecodeMsg

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

Source from the content-addressed store, hash-verified

5839}
5840
5841func BenchmarkInt32Sorted_DecodeMsg(b *testing.B) {
5842 sizes := []int{10, 100, 1000}
5843
5844 for _, size := range sizes {
5845 b.Run(fmt.Sprintf("%d", size), func(b *testing.B) {
5846 set := make(Int32Sorted)
5847 for i := 0; i < size; i++ {
5848 set[int32(i)] = struct{}{}
5849 }
5850
5851 var buf bytes.Buffer
5852 writer := msgp.NewWriter(&buf)
5853 set.EncodeMsg(writer)
5854 writer.Flush()
5855 encoded := buf.Bytes()
5856
5857 b.ReportAllocs()
5858 b.ResetTimer()
5859 for i := 0; i < b.N; i++ {
5860 reader := msgp.NewReader(bytes.NewReader(encoded))
5861 var decoded Int32Sorted
5862 decoded.DecodeMsg(reader)
5863 }
5864 })
5865 }
5866}
5867
5868func BenchmarkInt32Sorted_MarshalMsg(b *testing.B) {
5869 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…