MCPcopy Create free account
hub / github.com/segmentio/encoding / BenchmarkEncodeMap

Function BenchmarkEncodeMap

proto/encode_test.go:84–103  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

82}
83
84func BenchmarkEncodeMap(b *testing.B) {
85 buf := [128]byte{}
86 msg := struct {
87 M map[string]string
88 }{
89 M: map[string]string{
90 "hello": "world",
91 },
92 }
93
94 size := Size(msg)
95 data := buf[:size]
96 b.SetBytes(int64(size))
97
98 for range b.N {
99 if _, err := MarshalTo(data, msg); err != nil {
100 b.Fatal(err)
101 }
102 }
103}
104
105func BenchmarkEncodeSlice(b *testing.B) {
106 buf := [128]byte{}

Callers

nothing calls this directly

Calls 2

SizeFunction · 0.85
MarshalToFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…