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

Function BenchmarkFloat64Sorted_DecodeMsg

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

Source from the content-addressed store, hash-verified

8479}
8480
8481func BenchmarkFloat64Sorted_DecodeMsg(b *testing.B) {
8482 sizes := []int{10, 100, 1000}
8483
8484 for _, size := range sizes {
8485 b.Run(fmt.Sprintf("%d", size), func(b *testing.B) {
8486 set := make(Float64Sorted)
8487 for i := 0; i < size; i++ {
8488 set[float64(i)] = struct{}{}
8489 }
8490
8491 var buf bytes.Buffer
8492 writer := msgp.NewWriter(&buf)
8493 set.EncodeMsg(writer)
8494 writer.Flush()
8495 encoded := buf.Bytes()
8496
8497 b.ReportAllocs()
8498 b.ResetTimer()
8499 for i := 0; i < b.N; i++ {
8500 reader := msgp.NewReader(bytes.NewReader(encoded))
8501 var decoded Float64Sorted
8502 decoded.DecodeMsg(reader)
8503 }
8504 })
8505 }
8506}
8507
8508func BenchmarkFloat64Sorted_MarshalMsg(b *testing.B) {
8509 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…