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

Function BenchmarkTestReadBytesHeader

msgp/read_bytes_test.go:127–143  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

125}
126
127func BenchmarkTestReadBytesHeader(b *testing.B) {
128 sizes := []uint32{1, 100, tuint16, tuint32}
129 buf := make([]byte, 0, 5*len(sizes))
130 for _, sz := range sizes {
131 buf = AppendBytesHeader(buf, sz)
132 }
133 b.SetBytes(int64(len(buf) / len(sizes)))
134 b.ReportAllocs()
135 b.ResetTimer()
136 o := buf
137 for i := 0; i < b.N; i++ {
138 _, buf, _ = ReadBytesHeader(buf)
139 if len(buf) == 0 {
140 buf = o
141 }
142 }
143}
144
145func TestReadNilBytes(t *testing.T) {
146 var buf bytes.Buffer

Callers

nothing calls this directly

Calls 2

AppendBytesHeaderFunction · 0.85
ReadBytesHeaderFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…