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

Function BenchmarkEncodeSlice

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

Source from the content-addressed store, hash-verified

103}
104
105func BenchmarkEncodeSlice(b *testing.B) {
106 buf := [128]byte{}
107 msg := struct {
108 S []int
109 }{
110 S: []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
111 }
112
113 size := Size(msg)
114 data := buf[:size]
115 b.SetBytes(int64(size))
116
117 for range b.N {
118 if _, err := MarshalTo(data, &msg); err != nil {
119 b.Fatal(err)
120 }
121 }
122}

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…