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

Function BenchmarkFloat64_DecodeMsg

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

Source from the content-addressed store, hash-verified

8342}
8343
8344func BenchmarkFloat64_DecodeMsg(b *testing.B) {
8345 sizes := []int{10, 100, 1000}
8346
8347 for _, size := range sizes {
8348 b.Run(fmt.Sprintf("%d", size), func(b *testing.B) {
8349 set := make(Float64)
8350 for i := 0; i < size; i++ {
8351 set[float64(i)] = struct{}{}
8352 }
8353
8354 var buf bytes.Buffer
8355 writer := msgp.NewWriter(&buf)
8356 set.EncodeMsg(writer)
8357 writer.Flush()
8358 encoded := buf.Bytes()
8359
8360 b.ReportAllocs()
8361 b.ResetTimer()
8362 for i := 0; i < b.N; i++ {
8363 reader := msgp.NewReader(bytes.NewReader(encoded))
8364 var decoded Float64
8365 decoded.DecodeMsg(reader)
8366 }
8367 })
8368 }
8369}
8370
8371func BenchmarkFloat64_MarshalMsg(b *testing.B) {
8372 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…