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

Function BenchmarkFloat32_DecodeMsg

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

Source from the content-addressed store, hash-verified

9002}
9003
9004func BenchmarkFloat32_DecodeMsg(b *testing.B) {
9005 sizes := []int{10, 100, 1000}
9006
9007 for _, size := range sizes {
9008 b.Run(fmt.Sprintf("%d", size), func(b *testing.B) {
9009 set := make(Float32)
9010 for i := 0; i < size; i++ {
9011 set[float32(i)] = struct{}{}
9012 }
9013
9014 var buf bytes.Buffer
9015 writer := msgp.NewWriter(&buf)
9016 set.EncodeMsg(writer)
9017 writer.Flush()
9018 encoded := buf.Bytes()
9019
9020 b.ReportAllocs()
9021 b.ResetTimer()
9022 for i := 0; i < b.N; i++ {
9023 reader := msgp.NewReader(bytes.NewReader(encoded))
9024 var decoded Float32
9025 decoded.DecodeMsg(reader)
9026 }
9027 })
9028 }
9029}
9030
9031func BenchmarkFloat32_MarshalMsg(b *testing.B) {
9032 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…