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

Function BenchmarkReadArrayHeaderBytes

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

Source from the content-addressed store, hash-verified

81}
82
83func BenchmarkReadArrayHeaderBytes(b *testing.B) {
84 sizes := []uint32{1, 100, tuint16, tuint32}
85 buf := make([]byte, 0, 5*len(sizes))
86 for _, sz := range sizes {
87 buf = AppendArrayHeader(buf, sz)
88 }
89 b.SetBytes(int64(len(buf) / len(sizes)))
90 b.ReportAllocs()
91 b.ResetTimer()
92 o := buf
93 for i := 0; i < b.N; i++ {
94 _, buf, _ = ReadArrayHeaderBytes(buf)
95 if len(buf) == 0 {
96 buf = o
97 }
98 }
99}
100
101func TestReadBytesHeader(t *testing.T) {
102 var buf bytes.Buffer

Callers

nothing calls this directly

Calls 2

AppendArrayHeaderFunction · 0.85
ReadArrayHeaderBytesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…