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

Function BenchmarkFloat32Sorted_DecodeMsg

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

Source from the content-addressed store, hash-verified

9139}
9140
9141func BenchmarkFloat32Sorted_DecodeMsg(b *testing.B) {
9142 sizes := []int{10, 100, 1000}
9143
9144 for _, size := range sizes {
9145 b.Run(fmt.Sprintf("%d", size), func(b *testing.B) {
9146 set := make(Float32Sorted)
9147 for i := 0; i < size; i++ {
9148 set[float32(i)] = struct{}{}
9149 }
9150
9151 var buf bytes.Buffer
9152 writer := msgp.NewWriter(&buf)
9153 set.EncodeMsg(writer)
9154 writer.Flush()
9155 encoded := buf.Bytes()
9156
9157 b.ReportAllocs()
9158 b.ResetTimer()
9159 for i := 0; i < b.N; i++ {
9160 reader := msgp.NewReader(bytes.NewReader(encoded))
9161 var decoded Float32Sorted
9162 decoded.DecodeMsg(reader)
9163 }
9164 })
9165 }
9166}
9167
9168func BenchmarkFloat32Sorted_MarshalMsg(b *testing.B) {
9169 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…